mercredi 27 janvier 2016

How to enable a checkbox in Gridview only when it's in the Edit mode?

This is how I have my 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 my code behind because it's not necessary. Basically, a user can check or uncheck it, but it won't be reflected in the database unless I actually go into Edit mode, check or uncheck it, and then hit update so that the changes ARE reflected in the database.

Is there a way to have it so that the checkbox is "disabled" or anything of that sort while it's not in edit mode?




Aucun commentaire:

Enregistrer un commentaire