I have a datagrid with a checkbox which displays the boolean result from a database. My code for the datagrid is as follows:
Code:
<asp:DataGrid id="dgQuiz" runat="server" OnEditCommand="dgQuiz_Edit" OnCancelCommand="dgQuiz_Cancel" OnUpdateCommand="dgQuiz_Update" AutoGenerateColumns="False" Width="560px">
<columns>
<asp:templatecolumn headerstyle-font-bold=True headerstyle-horizontalalign=Center></asp:templatecolumn>
<asp:BoundColumn Visible="False" DataField="IDP" SortExpression="id" HeaderText="IDP"></asp:BoundColumn>
<asp:templatecolumn headertext="Active">
<itemtemplate>
<asp:checkbox runat="server" enabled="True" name="Checkbox2" id="Checkbox2" checked = '<%# DataBinder.Eval(Container, "DataItem.Active") %>' ></asp:checkbox>
</itemtemplate>
<edititemtemplate>
<asp:checkbox runat="server" name="Checkbox2" id="Checkbox1" checked = '<%# DataBinder.Eval(Container, "DataItem.Active") %>' ></asp:checkbox>
</edititemtemplate>
</asp:templatecolumn>
<asp:HyperLinkColumn Target="_self" DataNavigateUrlField="IDP" DataNavigateUrlFormatString="QuizQuestions.aspx?TestIDP={0}" DataTextField="Name" HeaderText="Quiz"></asp:HyperLinkColumn>
<asp:HyperLinkColumn Target="_self" DataNavigateUrlField="IDP" DataNavigateUrlFormatString="PrintQuizAnswerKey.aspx?TestIDP={0}" DataTextField="Name" HeaderText="Answer Key"></asp:HyperLinkColumn>
<asp:HyperLinkColumn Target="_self" DataNavigateUrlField="IDP" DataNavigateUrlFormatString="PrintQuiz.aspx?TestIDP={0}" DataTextField="Name" HeaderText="Print"></asp:HyperLinkColumn>
<asp:EditCommandColumn EditText="Edit" CancelText="Cancel" UpdateText="Update" ItemStyle-Wrap="false" HeaderText="Edit Command Column" HeaderStyle-Wrap="false" />
</Columns>
</asp:DataGrid>
I want to allow the user to change the checkbox value and click update to save the change similar to how this page works:
http://samples.gotdotnet.com/quickst...datagrid6.aspx
but I cant figure out how to do the code behind to determine the checkbox value and which row the user is working with...basically I need help with the "dgQuiz_Update" Sub...
-------------------------
Beware of programmers with screwdrivers...