Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Jørn A #1
Adding javascript client-side funtionality to a Button webcontrol
I just learned how to add client-side javascript funtionality to a Button
Web control by using the Attributes.Add method at run-time.
myButton.Attributes.Add("onClick", "return confirm('Are you sure about
this?');")
But the problem arises when I want to add similar conditional funtionality
to buttons i a datagrid:
I have a datagrid in one of my pages where I want one column with buttons. I
want these buttons to open a new page in a new browser window, passing
different querystring parameters based on values from the record for the
specific datagrid-row.
The client-side attribute for the button in a specific datagrid row should
be something like:
onClick="window.open('theotherpage.asp?id=thisreco rdsid&customer=thisrecords
customer
Can anyone show an example of how to accomplish this (preferably in VB.Net)?
Jørn A Guest
-
Hit Counter in Javascript on client side.
Have opportunity to use free web server space but can only use client scripting. How to code hit counter in javascript? Any help would be... -
JavaScript Access to Button in form tags (webcontrol or html button)
Hello, I have a button called LoadBtn, which exists in <form name="Form1" runat=server></form> tags. I then have javascript loaded outside of... -
Loading client-side images for use in Javascript
Ok, I'll play the dumb guy.... if your script is running on the server under the testapp application, why isn't the source 'Images/down.gif' (Path... -
how can i add client side javascript to a web user control?
hi, i have a web user control that i wish to add some client-side javascript to. something like this: onChange="javascript:DoSomething();" ... -
button evet ---- server side - client side ???
I want to use button. My question is that How can use server side and client site event at the same time. That is: I want to use button : when... -
Michael Tkachev #2
Re: Adding javascript client-side funtionality to a Button webcontrol
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<input type="button"
onclick="window.open('http://www.microsoft.com')" value="xxx" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
"Jørn A" <nospamwanted@nospam.no> wrote in message
news:%23BipkGoMEHA.628@TK2MSFTNGP11.phx.gbl...I> I just learned how to add client-side javascript funtionality to a Button
> Web control by using the Attributes.Add method at run-time.
> myButton.Attributes.Add("onClick", "return confirm('Are you sure about
> this?');")
>
> But the problem arises when I want to add similar conditional funtionality
> to buttons i a datagrid:
> I have a datagrid in one of my pages where I want one column with buttons.onClick="window.open('theotherpage.asp?id=thisreco rdsid&customer=thisrecords> want these buttons to open a new page in a new browser window, passing
> different querystring parameters based on values from the record for the
> specific datagrid-row.
> The client-side attribute for the button in a specific datagrid row should
> be something like:
>
>VB.Net)?> customer
>
> Can anyone show an example of how to accomplish this (preferably in>
>
Michael Tkachev Guest
-
Jørn A #3
Re: Adding javascript client-side funtionality to a Button webcontrol
That's OK, but you did not use a WebControl in your example... I need to use
a WebControl for the other funtionality in my page. A standard input HTML
tag won't do.
I thought of using a HTMLControl (input) instead of a WebControl, but then I
had a new problem with ASPNET HTML-encoding the content of my onClick event.
Any more suggestions anyone?
-Jørn A.
"Michael Tkachev" <m_tkachev@hotmail.com> wrote in message
news:ea2y8KpMEHA.2736@TK2MSFTNGP11.phx.gbl...Button>
> <Columns>
> <asp:TemplateColumn>
> <ItemTemplate>
> <input type="button"
> onclick="window.open('http://www.microsoft.com')" value="xxx" />
> </ItemTemplate>
> </asp:TemplateColumn>
> </Columns>
>
> "Jørn A" <nospamwanted@nospam.no> wrote in message
> news:%23BipkGoMEHA.628@TK2MSFTNGP11.phx.gbl...> > I just learned how to add client-side javascript funtionality to aabout> > Web control by using the Attributes.Add method at run-time.
> > myButton.Attributes.Add("onClick", "return confirm('Are you surefuntionality> > this?');")
> >
> > But the problem arises when I want to add similar conditionalbuttons.> > to buttons i a datagrid:
> > I have a datagrid in one of my pages where I want one column withshould> I> > want these buttons to open a new page in a new browser window, passing
> > different querystring parameters based on values from the record for the
> > specific datagrid-row.
> > The client-side attribute for the button in a specific datagrid rowonClick="window.open('theotherpage.asp?id=thisreco rdsid&customer=thisrecords>> > be something like:
> >
> >> VB.Net)?> > customer
> >
> > Can anyone show an example of how to accomplish this (preferably in>> >
> >
>
Jørn A Guest
-
Benyamin Maengkom #4
Re: Adding javascript client-side funtionality to a Button webcontrol
Private Sub ItemCreated(ByVal Sender As Object, ByVal E As
DataGridItemEventArgs) Handles Datagrid1.ItemCreated
Select Case E.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem,
ListItemType.SelectedItem
Dim drv As DataRowView = E.Item.DataItem
Dim theimagebutton As ImageButton
theimagebutton = E.Item.FindControl("theimagebutton") 'note
: theimagebutton is the name of control too...
theimagebutton.Attributes.Add("onclick",
"window.open('theotherpage.asp?id= & drv.Item("thisrecordsid") &
"&customer=" & drv.Item("thisrecordscustomer") & "');")
End Select
End Sub
"Jørn A" <nospamwanted@nospam.no> wrote in message
news:O8xTPRqMEHA.624@TK2MSFTNGP11.phx.gbl...use> That's OK, but you did not use a WebControl in your example... I need toI> a WebControl for the other funtionality in my page. A standard input HTML
> tag won't do.
>
> I thought of using a HTMLControl (input) instead of a WebControl, but thenevent.> had a new problem with ASPNET HTML-encoding the content of my onClickthe>
> Any more suggestions anyone?
>
> -Jørn A.
>
> "Michael Tkachev" <m_tkachev@hotmail.com> wrote in message
> news:ea2y8KpMEHA.2736@TK2MSFTNGP11.phx.gbl...> Button> >
> > <Columns>
> > <asp:TemplateColumn>
> > <ItemTemplate>
> > <input type="button"
> > onclick="window.open('http://www.microsoft.com')" value="xxx" />
> > </ItemTemplate>
> > </asp:TemplateColumn>
> > </Columns>
> >
> > "Jørn A" <nospamwanted@nospam.no> wrote in message
> > news:%23BipkGoMEHA.628@TK2MSFTNGP11.phx.gbl...> > > I just learned how to add client-side javascript funtionality to a> about> > > Web control by using the Attributes.Add method at run-time.
> > > myButton.Attributes.Add("onClick", "return confirm('Are you sure> funtionality> > > this?');")
> > >
> > > But the problem arises when I want to add similar conditional> buttons.> > > to buttons i a datagrid:
> > > I have a datagrid in one of my pages where I want one column with> > I> > > want these buttons to open a new page in a new browser window, passing
> > > different querystring parameters based on values from the record foronClick="window.open('theotherpage.asp?id=thisreco rdsid&customer=thisrecords> should> > > specific datagrid-row.
> > > The client-side attribute for the button in a specific datagrid row>> >> > > be something like:
> > >
> > >>> > VB.Net)?> > > customer
> > >
> > > Can anyone show an example of how to accomplish this (preferably in> >> > >
> > >
> >
>
Benyamin Maengkom Guest



Reply With Quote

