GridView triggering javascript

G

Guest

Hello,

I need a column in a GridView to trigger a javascript function ( to play an
MP3 file).

I am catching the RowCreated event from the GridView.
I then add my javascript code like this:

protected void OnRowCreated(object sender, GridViewRowEventArgs e) {
if(e.Row.RowType == DataControlRowType.DataRow) {

e.Row.Cells[6].Attributes.Add("oncommand","javascript:alert('foo')");

}

}



The alert window is never seen ( the Cells[6] is an ItemTemplate containing
a button.)



How can I add javascript code dyncamically to a column in a GridView?



Thanks,

bruce
 

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

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,161
Latest member
GertrudeMa
Top