asp.net - Gridview edit not working -
i have following gridview:
<asp:gridview id="grdall" runat="server" autogeneratecolumns="false" showheader="false" width="40%" gridlines="none" cellpadding="2" cellspacing="2"> <alternatingrowstyle cssclass="altcolor22" /> <rowstyle cssclass="altcolor21" /> <columns> <asp:templatefield> <itemtemplate> <table width="100%" class="tableborder"> <tr> <td valign="top" align="left"> <asp:label id="lblname" runat="server" /> <hr /> </td> </tr> <tr> <td valign="top" align="left" class="tableborder"> <asp:gridview id="grdcontent" runat="server" autogeneratecolumns="false" width="100%" gridlines="none" cellpadding="2" cellspacing="2" onrowdatabound="grdcontent_rowdatabound" onrowediting="grdcontent_rowediting"><%----%> <columns> <asp:templatefield headertext="kiosk id" headerstyle-horizontalalign="left"> <itemtemplate> <asp:label id="lblkiosid" runat="server"></asp:label> </itemtemplate> <edititemtemplate> <asp:textbox id="txtkiosk" runat="server" text ='<%#eval("hbemailid") %>'></asp:textbox> </edititemtemplate> <headerstyle horizontalalign="left" /> </asp:templatefield> <asp:templatefield headertext="email id" headerstyle-horizontalalign="left"> <headerstyle horizontalalign="left" /> <itemtemplate> <asp:label id="lblemail" runat="server"></asp:label> </itemtemplate> <edititemtemplate> <asp:textbox id="txtemail" runat="server" text ='<%#eval("hbemailid") %>'></asp:textbox> </edititemtemplate> </asp:templatefield> <asp:templatefield showheader="false"> <itemtemplate> <asp:linkbutton id="linkbutton1" runat="server" commandname="edit" text="edit" ></asp:linkbutton> </itemtemplate> <edititemtemplate> <asp:linkbutton id="linkbutton3" runat="server" commandname="update" text="update"></asp:linkbutton> <asp:linkbutton id="linkbutton2" runat="server" commandname="cancel" text="cancel"></asp:linkbutton> </edititemtemplate> </asp:templatefield> </columns> </asp:gridview> </td> </tr> </table> </itemtemplate> </asp:templatefield> </columns> </asp:gridview> in this, edit functionality not working.
in clicking of edit button, shows me nothing. (it should show me textbox edit)
following code:
protected sub grdcontent_rowediting(byval sender object, byval e system.web.ui.webcontrols.gridviewediteventargs) dim row gridviewrow = directcast(trycast(sender, control).parent.parent, gridviewrow) dim index integer = row.rowindex ctype(row.findcontrol("grdcontent"), gridview).editindex = e.neweditindex dbname = ctype(row.findcontrol("lblname"), label).text bindcontentgrid(ctype(row.findcontrol("grdcontent"), gridview), dbname) end sub please me, not gives me error, not showing me textbox edit.
the issue on following code
bindcontentgrid(ctype(row.findcontrol("grdcontent"), gridview), dbname) if code not return records, nothing displayed. make sure returning rows.
Comments
Post a Comment