asp.net - How to enable a checkbox in Gridview only when it's in the Edit mode? -
this how have checkbox column currently:
<asp:templatefield headertext="hide/show" itemstyle-horizontalalign="center" sortexpression="hide_show"> <itemtemplate> <asp:checkbox id="hideshowchk" runat="server" checked='<%# bind("hide_show") %>' /> </itemtemplate> </asp:templatefield>
i have no code in code behind because it's not necessary. basically, user can check or uncheck it, won't reflected in database unless go edit mode, check or uncheck it, , hit update changes reflected in database.
is there way have checkbox "disabled" or of sort while it's not in edit mode?
you have use edititemtemplate enabling in edit mode
<edititemtemplate> <asp:checkbox id="hideshowchk" runat="server" checked='<%# bind("hide_show") %>' /> </edititemtemplate>
if still want use check box inside itemtemplate make disable using css or jquery.
Comments
Post a Comment