Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you are using a GridView, building on the example from a previous example you got, you can do this. ** this is semi-pseudo code, beware**</p> <pre><code>&lt;asp:gridview id="CustomersGridView" datasourceid="CustomersSqlDataSource" autogeneratecolumns="false" autogenerateeditbutton="true" allowpaging="true" datakeynames="CustomerID" runat="server"&gt; &lt;columns&gt; &lt;asp:templatefield&gt; &lt;itemtemplate&gt; &lt;%-- This is itemtemplate so they are visible by default --%&gt; &lt;asp:CheckBox ID="cbVerify" runat="server"&gt;&lt;/asp:CheckBox&gt; &lt;asp:HiddenField ID="hidID" runat="server" Value='&lt;%# Bind("CustomerID") %&gt;'&gt;&lt;/asp:HiddenField&gt; &lt;/itemtemplate&gt; &lt;/asp:templatefield&gt; &lt;asp:boundfield datafield="CustomerID" readonly="true" headertext="Customer ID"/&gt; &lt;asp:boundfield datafield="CompanyName" readonly="true" headertext="Customer Name"/&gt; &lt;asp:boundfield datafield="Address" headertext="Address"/&gt; &lt;asp:boundfield datafield="City" headertext="City"/&gt; &lt;asp:boundfield datafield="PostalCode" headertext="ZIP Code"/&gt; &lt;/columns&gt; &lt;/asp:gridview&gt; &lt;asp:Button ID="btSubmit" runat="server" OnClick="btSubmit_Click"&gt;&lt;/asp:Button&gt; </code></pre> <p>Code behind to process this</p> <pre><code>public void btSubmit_Click(object sender, EventArgs e) { foreach (GridViewRow row in CustomersGridView.Rows) { CheckBox cbVerify = (CheckBox)row.FindControl("cbVerify"); HiddenField hidID = (HiddenField)row.FindControl("hidID"); // Do your validation of the data here .. if (cbVerify != null) { // Add fields and update sqlRecord.UpdateParameters["ID"].DefaultValue = hidID.Value; sqlRecord.UpdateParameters["Valid"].DefaultValue = cbVerify.Checked.ToString(); sqlRecord.Update(); } } </code></pre> <p>This should get you in a specific direction to look.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload