Update a checkbox inside a gridview edit itemtemplate

280 views Asked by At

My itemTemplate displays a picture of a check or a cross depending on the bool value. But when I try to update the edit template using a checkbox, the new value isn't accepted. Clicking on update refreshed the page and nothing happens. If I remove this field, the gridview and database do get updated. There's no code behind the gridview, it's all in markup. Any suggestions?

<asp:TemplateField HeaderText="Transferred"
                SortExpression="ownershipTransferred" >
                  <EditItemTemplate>
                      <asp:CheckBox ID="CheckBox1" runat="server"/>
                  </EditItemTemplate>
                <ItemTemplate>
                            <asp:Image ID="Image3" runat="server" ImageUrl='<%# (Eval("ownershipTransferred").Equals(true) ? "~/images/wcheck.png" : "~/images/wcross.png")%>' Height="18" />

                           </ItemTemplate>
0

There are 0 answers