asp.net - Gridview finding control in gridview -
how find control of gridview in user defined function ... throws
dataset ds = objselectall.paging(pagesize, pagenumber, userid, roleid); if (session["username"].tostring() == "admin") { foreach (gridviewrow row in userrolegridview.rows) { imagebutton imgeditbtn = (imagebutton)row.findcontrol("editbutton"); imagebutton imgdelbtn = (imagebutton)row.findcontrol("deletebutton"); dataset dsusr = objselectall.userbasedpaging(pagesize, pagenumber, userid, roleid); userrolegridview.datasource = dsusr.tables[1]; userrolegridview.databind(); ...
you need check current row data row or header row.
for checking row type need write
if(row.rowtype == datacontrolrowtype.datarow) { // ever want }
now code like
foreach(gridviewrow row in gridview1.rows) { if(row.rowtype == datacontrolrowtype.datarow) { // ever want } }
i hope fix problem.
Comments
Post a Comment