Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Generating client-side code from the server.

Reply
Thread Tools

Generating client-side code from the server.

 
 
bvly
Guest
Posts: n/a
 
      07-21-2003
I'm not sure if this is what you are trying to do, but I
was able to get an alert box from a datagrid by using a
TemplateColumn and ItemTemplate with a button to call a
function:
<script language="JavaScript">
function TestGridCall(src,args){
alert("Hello" + event.srcElement.name);
}

</script>

<asp:TemplateColumn>
<ItemTemplate>
<input type="button" name="xx" nclick="TestGridCall
()"/>
</ItemTemplate>
</asp:TemplateColumn>

You'd have to explicitly create the columns.


>-----Original Message-----
>Can someone give me the server event/code to give a Web
>Form DataGrid client-side JavaScript that would result in
>the grid having a JavaScript onClick event handler for
>each row of the grid?
>
>Thank you!
>.
>

 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      07-21-2003
No, that's not quite what I'm looking for.

I don't want to add any additional columns to the grid at all. I want to
wind up with [<TR onClick="...javascript...">] in the DataGrid's resulting
HTML sent to the client. Because the HTML for the grid is rendered at run
time, you must add this code to one of the grid's events (render?) and what
the actual code is to add the script to that HTML I don't know.


"bvly" <(E-Mail Removed)> wrote in message
news:019701c34fc0$7ea518d0$(E-Mail Removed)...
> I'm not sure if this is what you are trying to do, but I
> was able to get an alert box from a datagrid by using a
> TemplateColumn and ItemTemplate with a button to call a
> function:
> <script language="JavaScript">
> function TestGridCall(src,args){
> alert("Hello" + event.srcElement.name);
> }
>
> </script>
>
> <asp:TemplateColumn>
> <ItemTemplate>
> <input type="button" name="xx" nclick="TestGridCall
> ()"/>
> </ItemTemplate>
> </asp:TemplateColumn>
>
> You'd have to explicitly create the columns.
>
>
> >-----Original Message-----
> >Can someone give me the server event/code to give a Web
> >Form DataGrid client-side JavaScript that would result in
> >the grid having a JavaScript onClick event handler for
> >each row of the grid?
> >
> >Thank you!
> >.
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating HTML code in the code-behind lisa@starways.net ASP .Net Web Controls 2 09-25-2005 05:24 PM
Generating HTML code in the code-behind lisa@starways.net ASP .Net Building Controls 2 09-25-2005 05:24 PM
td tag generating faulty code Naveen K Kohli ASP .Net 1 05-13-2005 09:00 PM
Generating HTML code =?Utf-8?B?Y25pY2ts?= ASP .Net 2 03-22-2005 02:24 PM
Generating Javascript from a button in Code-behind Nevyn Twyll ASP .Net 4 03-06-2004 08:31 AM



Advertisments