Generating client-side code from the server.

B

bvly

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.
 
S

Scott M.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top