GridView triggering javascript

GridView triggering javascript

am 22.01.2008 06:00:16 von Tullamore

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