javascript not firing after setting onclientclick in gridview rowdatabound -
i want fire javascript confirm deleting row.
this rowdatabound
private sub gridslide_rowdatabound(byval sender object, byval e system.web.ui.webcontrols.gridviewroweventargs) handles gridslide.rowdatabound if e.row.rowtype = datacontrolrowtype.datarow directcast(e.row.findcontrol("linkdelete"), linkbutton).attributes.add("onclientclick", "javascript:deleteslide('" & convert.tostring(e.row.rowindex) & "')") end if end sub this javascript
function deleteslide(var_row) { var blnresponse = null; var strmessage = ''; try { strmessage = 'are sure want delete slide data?'; blnresponse = window.confirm(strmessage); if (blnresponse) { __dopostback('deleteslide()', var_row ); } } catch (err) { alert('deleteslide - ' + err.description); } } but when click delete link button, javascript won't fire.
what's problem?
p.s. tried using commandargument , container.dataitemindex caused whole lot more errors ended using rowdatabound.
try this:
directcast(e.row.findcontrol("linkdelete"), linkbutton).onclientclick = "javascript:deleteslide('" & convert.tostring(e.row.rowindex) & "')";
Comments
Post a Comment