ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Update column status from 0 to 1 on Button Click in ASP.Net<p>Hi <a class="username" rel="VinitaAkha">VinitaAkha</a>,</p> <p>You have taken TemplateField in GridView so you need to find the controls which control you want. Try below code.</p> <p><span style="text-decoration: underline;"><strong>Code</strong></span></p> <pre class="brush: csharp">protected void Button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(); foreach (GridViewRow row in gvData.Rows) { CheckBox status = (row.Cells[1].FindControl(&#34;chk&#34;) as CheckBox); if (status.Checked) { try { SqlCommand cmd = new SqlCommand(&#34;Update AddRaw_199 set status = 1 where Name= + &#39;&#34; + (row.FindControl(&#34;Name&#34;) as Label).Text + &#34;&#39;&#34;); cmd.CommandType = CommandType.Text; cmd.Connection = con; con.Open(); int suc = cmd.ExecuteNonQuery(); } catch { } finally { if (con.State == ConnectionState.Open) { con.Close(); } } } } lbl_app.CssClass = &#34;text-center text-success&#34;; Response.Redirect(&#34;ViewFarmer.aspx&#34;); lbl_app.Text = &#34;Status Updated Successfully&#34;; }</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/195869/Update-column-status-from-0-to-1-on-Button-Click-in-ASPNet/https://www.aspforums.net:443/Threads/195869/Update-column-status-from-0-to-1-on-Button-Click-in-ASPNet/Thu, 08 Aug 2019 06:32:06 GMT