I am trying to add an onclick event to a string as soon as the data is bound to a webview. In the code below, no attributes are added (the source of the views is checked after the page is created), and, of course, the functionality is not added. Right now, I just got an onclick print on the page, but it will eventually link to another page. Any ideas on what's wrong?
Also thanks to the stackoverflow community as a whole. This community has always been of great help. Plan to go through some posts this weekend and start answering questions of how I can give a little.
C # server side
protected void dataTbl_RowDataBound(GridViewRowEventArgs e){ e.Row.Attributes.Add("id",e.Row.Cells[0].Text); e.Row.Attributes.Add("onclick", "rowClick('"+e.Row.RowIndex+"')"); }
Client side Javascript
function rowClicked(counter){ document.write(counter); }
steventnorris
source share