Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You'll want to use the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand.aspx" rel="nofollow">GridView.RowCommand event</a></p> <p>Make sure to add the OnRowCommand listener to the GridView then update accordingly</p> <pre><code>Public Sub gridview1_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) If e.CommandName = "UpdateDoNotMail" Then With Me.SqlDataSource1 Dim box As CheckBox = DirectCast(sender, CheckBox) If box.Checked = True Then donotmail.SelectedValue = 1 .ConnectionString = ConfigurationManager.AppSettings("AgentLeadsConnectionString").ToString .UpdateCommand = "UPDATE MktDataLeads_scrubbed set donotmail=@donotmail" Else donotmail.SelectedValue = 0 .ConnectionString = ConfigurationManager.AppSettings("AgentLeadsConnectionString").ToString .UpdateCommand = "UPDATE MktDataLeads_scrubbed set donotmail=@donotmail" End If End With End If End Sub </code></pre> <p>and the TemplateField</p> <pre><code> &lt;asp:TemplateField HeaderText="DoNotMail" SortExpression="DoNotMail"&gt; &lt;ItemTemplate&gt; &lt;asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" CommandName="UpdateDoNotMail" Checked='&lt;%# Bind("DoNotMail") %&gt;' Enabled="true" /&gt; &lt;/ItemTemplate&gt; &lt;EditItemTemplate&gt; &lt;asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" CommandName="UpdateDoNotMail" Checked='&lt;%# Bind("DoNotMail") %&gt;' /&gt; &lt;/EditItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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