Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
foreach (GridViewRow rowI
tem in GridView1.Rows)
{
      CheckBox chk = (CheckBox)(rowItem.Cells[7].FindControl("ch1"));
      try
      {
          if (chk == null)
          {
              Label3.Text = "hai";
              SqlConnection myConnection = new SqlConnection("Data Source=PCIMS051;Initial Catalog=unblockingwebsite;Integrated Security=True");
              myConnection.Open();
              SqlCommand myCommand = new SqlCommand("INSERT INTO twebsite_unblocking (Requested_Status) " + "Values ('2')", myConnection);
              myCommand.ExecuteNonQuery();
              myConnection.Close();
          }
      }
      catch { }
      
     }


Update Cancel Requested_ID Requested_by Action_taken Action_remark Action_taken_by Action_taken_date Request_Status


Label text changed but check box status not changed and not update to gridview
Posted
Updated 27-Nov-12 19:48pm
v2
Comments
Mohd. Mukhtar 28-Nov-12 1:50am    
What error you are getting here?

1 solution

//if coloumn datatype is int then remove qouts example values(2)


// validate whether changes made to database
C#
if(  myCommand.ExecuteNonQuery() > 0 )
            {
                Response.Write("success");
            }
            else
            {
                Response.Write("failed");
            }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900