I want that my Reader result object fetch matchinng id which matches q=with 2 tables and then get result and save it. and then row data bound function match with all grid and if match on any row it Checked checkbox of that row
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string qry = "SELECT id FROM info INTERSECT SELECT id FROM info2;";
SqlCommand cmd = new SqlCommand(qry, con);
con.Close();
if (con.State == ConnectionState.Closed)
{
con.Open();
// string result = ((string)cmd.ExecuteScalar());
int result = ((int)cmd.ExecuteScalar());
//SqlDataReader dr = cmd.ExecuteReader();
// CheckBox chk = (CheckBox)e.Row.cells[0].FindControl("chkMyCheckBox");
CheckBox Chbox = (CheckBox)e.Row.Cells[0].FindControl("chb1");
if (e.Row.Cells[1].Text == result.ToString())
{
Chbox.Checked = true;
e.Row.Cells[1].ForeColor = System.Drawing.Color.Red;
}
else if (e.Row.Cells[2].Text == "1")
{
e.Row.Cells[1].ForeColor = System.Drawing.Color.Black;
}
else
{
e.Row.Cells[1].ForeColor = System.Drawing.Color.Green;
}
}
}