E
et
All the articles on checkboxes in a datagrid revolve around using the
checkboxes for user selection.
I need to have a checkbox inserted and its value based on a the dataset the
grid is bound to. How do I retrieve that value?
This is my datagrid:
<asp:datagrid id=dg runat="server" AutoGenerateColumns="False"
CellPadding="3" BackColor="White" BorderColor="#999999" BorderWidth="1px"
GridLines="Vertical" BorderStyle="None" >
<Columns>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
<asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
<asp:BoundColumn Visible="False" DataField="ID"
ReadOnly="True"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="FeePaid">
<ItemTemplate>
<%#Container.DataItem("FeePaid")%>
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox runat="server" ID="chkFeePaid"/>
</EditItemTemplate>
</asp:TemplateColumn>
</asp:datagrid
I don't know what to put in the code to get the checkbox, upon editing the
row, to get the value of the cell, then check or uncheck the checkbox
accordingly. I would also need to update the dataset and database with the
new value.
checkboxes for user selection.
I need to have a checkbox inserted and its value based on a the dataset the
grid is bound to. How do I retrieve that value?
This is my datagrid:
<asp:datagrid id=dg runat="server" AutoGenerateColumns="False"
CellPadding="3" BackColor="White" BorderColor="#999999" BorderWidth="1px"
GridLines="Vertical" BorderStyle="None" >
<Columns>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
<asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
<asp:BoundColumn Visible="False" DataField="ID"
ReadOnly="True"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="FeePaid">
<ItemTemplate>
<%#Container.DataItem("FeePaid")%>
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox runat="server" ID="chkFeePaid"/>
</EditItemTemplate>
</asp:TemplateColumn>
</asp:datagrid
I don't know what to put in the code to get the checkbox, upon editing the
row, to get the value of the cell, then check or uncheck the checkbox
accordingly. I would also need to update the dataset and database with the
new value.