public void chkStatus_OnCheckedChanged(object sender, EventArgs e) { CheckBox chkStatus = (CheckBox)sender; //GridViewRow row = (GridViewRow)chkStatus.NamingContainer; GridViewRow row = (GridViewRow)chkStatus.NamingContainer; string cid = row.Cells[1].Text; bool status = chkStatus.Checked; //ITWLTD-DEV01 ////string constr = @"Server=.\SQLEXPRESS;Database=TestDB;uid=waqas;pwd=sql;"; //string constr = @"Server=ITWLTD-DEV01;Database=property;Integrated Security=true;"; //string query = "UPDATE marketing SET Approved = @Approved WHERE id = @id"; //SqlConnection con = new SqlConnection(constr); //// SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString); //SqlCommand com = new SqlCommand(query, con); ////Convert.ToInt32(eInfo.isActive) //// Convert.ToBoolean(dataReader["isActive"]); string constr = @"Server=ITWLTD-DEV01;Database=property;Integrated Security=true;"; string query = "UPDATE market SET Approved = @Approved WHERE id = @id"; SqlConnection con = new SqlConnection(constr); SqlCommand com = new SqlCommand(query, con); com.Parameters.Add("@Approved", SqlDbType.Bit).Value = status; com.Parameters.Add("@id", Convert.ToInt32(SqlDbType.Int)).Value = cid; //com.Parameters.Add("@id", SqlDbType.Int).Value = cid; con.Open(); com.ExecuteNonQuery(); con.Close(); // LoadData(); BindData(); }
CheckBox chkStatus = (CheckBox)sender; //GridViewRow row = (GridViewRow)chkStatus.NamingContainer; GridViewRow row = (GridViewRow)chkStatus.NamingContainer;
CheckBox chkStatus = (CheckBox)sender; GridViewRow row = (GridViewRow)chkStatus.Parent;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)