asp.net - Edit template not displaying -
i have gridview has item template , edit template. problem is, whenever click edit button, edit templates don't show up.
here page code:
<asp:gridview id="routesgridview" runat="server" cssclass="table table-striped table-hover" gridlines="none" autogeneratecolumns="false" datakeynames="routeid,locationid,concurrencyid" allowpaging="true" emptydatatext="no information retrieved"> <columns> <asp:templatefield visible="false"> <edititemtemplate> <asp:label id="routeidlb" runat="server" text='<%# bind("routeid") %>'></asp:label> </edititemtemplate> <itemtemplate> <asp:label id="routeidlb" runat="server" text='<%# bind("routeid") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="name" sortexpression="name"> <edititemtemplate> <asp:textbox id="nametb" runat="server" text='<%# bind("name") %>'></asp:textbox> </edititemtemplate> <itemtemplate> <asp:label id="namelb" runat="server" text='<%# bind("name") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="description" sortexpression="description" > <edititemtemplate> <asp:textbox id="descriptiontb" runat="server" text='<%# bind("description") %>'></asp:textbox> </edititemtemplate> <itemtemplate> <asp:label id="descriptionlb" runat="server" text='<%# bind("description") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="time zone" sortexpression="timezonecode"> <edititemtemplate> <asp:dropdownlist id="timezoneddl" runat="server" datasource="<%# gettimezones() %>" appenddatabounditems="true" datatextfield="timezonecode" datavaluefield="timezoneid" selectedvalue='<%# bind("timezoneid") %>'> </asp:dropdownlist> </edititemtemplate> <itemtemplate> <asp:label id="label2" runat="server" text='<%# bind("timezonecode") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="is active" sortexpression="isactive" headerstyle-cssclass="textcenteralign" itemstyle-cssclass="textcenteralign"> <edititemtemplate> <asp:checkbox id="isactivecb" runat="server" checked='<%# bind("isactive") %>' /> </edititemtemplate> <itemtemplate> <%# iif(eval("isactive").equals(true), "<i class='icon-ok'></i>", " ")%> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="is deleted" sortexpression="isdeleted" headerstyle-cssclass="textcenteralign" itemstyle-cssclass="textcenteralign"> <edititemtemplate> <asp:checkbox id="isdeletedcb" runat="server" checked='<%# bind("isdeleted") %>' enabled="false" /> </edititemtemplate> <itemtemplate> <%# iif(eval("isdeleted").equals(true), "<i class='icon-ok'></i>", " ")%> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="actions" itemstyle-cssclass="actions"> <edititemtemplate> <asp:linkbutton id="savebutton" runat="server" cssclass="btn btn-mini btn-primary hiddenbutton" commandname="update" visible="true" enabled="true" tooltip="save pending changes" commandargument='<%# ctype(container, gridviewrow).rowindex %>'><i class="icon-ok icon-white"></i>save</asp:linkbutton> <asp:linkbutton id="cancelbutton" runat="server" cssclass="btn btn-mini btn-danger hiddenbutton" commandname="cancel" visible="true" enabled="true" tooltip="cancel pending changes" commandargument='<%# ctype(container, gridviewrow).rowindex %>'><i class="icon-ban-circle icon-white"></i>cancel</asp:linkbutton> </edititemtemplate> <itemtemplate> <asp:linkbutton id="editbutton" runat="server" cssclass="btn btn-mini btn-primary hiddenbutton" commandname="edit" visible="true" enabled="true" tooltip="edit entry" commandargument='<%# ctype(container, gridviewrow).rowindex %>'><i class="icon-edit icon-white"></i>edit</asp:linkbutton> <asp:linkbutton id="deletebutton" runat="server" cssclass="btn btn-mini btn-danger hiddenbutton" commandname="delete" visible="true" enabled="true" tooltip="delete entry" commandargument='<%# ctype(container, gridviewrow).rowindex %>' onclientclick='return confirm("are want delete entry?");'><i class="icon-trash icon-white"></i>delete</asp:linkbutton> </itemtemplate> </asp:templatefield> </columns> </asp:gridview>
vb code behind:
protected sub routesgridview_rowediting(byval sender system.object, byval e gridviewediteventargs) handles routesgridview.rowediting dim gv gridview = ctype(sender, gridview) dim row gridviewrow = gv.rows(e.neweditindex) dim routeid integer = cint(ctype(row.findcontrol("routeidlb"), label).text) _route = routemanager.getitem(routeid, _dftidentity) gv.editindex = e.neweditindex routesgridview_databind() end sub protected sub routesgridview_rowcancelingedit(byval sender system.object, byval e gridviewcancelediteventargs) handles routesgridview.rowcancelingedit _route = nothing routesgridview.editindex = -1 routesgridview_databind() end sub protected sub routesgridview_rowupdating(byval sender system.object, byval e system.web.ui.webcontrols.gridviewupdateeventargs) handles routesgridview.rowupdating try dim gv gridview = ctype(sender, gridview) dim row gridviewrow = gv.rows(e.rowindex) _route .name = ctype(row.findcontrol("nametb"), textbox).text .timezoneid = ctype(row.findcontrol("timezoneddl"), dropdownlist).selectedvalue .isactive = ctype(row.findcontrol("isactivecb"), checkbox).checked end routemanager.update(_route, _dftidentity) _route = nothing gv.editindex = -1 routesgridview_databind() catch ex exception processexception(ex) end try end sub
you need change grid edit form property auto template
Comments
Post a Comment