I AM USING GRIDVIEW. THERE IS 3 COLUMN.E.G. FIRST IS CHECKBOX THEN NAME THEN ADDRESS.
CHECKBOX CHECKED FROM THE VALUE OF ANOTHER TABLE AND OTHER TWO FIELDS COME FROM FIRST TABLE. I ALSO WANT TO DISPLAY ALL RECORDS FROM THE FIRST TABLE.
I WANT THAT .........
IF I SELECT THE NAME FROM DROPDOWN LIST AND IF ITS VALUE TRUE FROM OTHER TABLE IS AUTOMATICLY CHECKED. AND ALSO I WANT DISPLAY OTHER DATA IN GRID FROM FIRST TABLE AND ITS VALUE FOR CHECKBOX FALSE IF IT IS NOT MATCH...
SOOO, IN SORT I WANT TO CHECKBOX CHECKED TRUE IF MATCH AND FALSE IF IT NOT MATCH AND DISPLAY ALL RECORDS FROM FIRST TABLE..
CODE WHICH I HAVE USE :
protected void Button1_Click1(object sender, EventArgs e)
{
String xxx = "";
Button2.Visible = true;
Panel1.Visible = true;
string s = "select document_id,user_id from document_rights where user_id='" + drop_user.SelectedItem.Value + "' and category='" + drop_cat.SelectedItem.Value + "' and sub_cat='" + drop_sub_cat.SelectedItem.Value + "'";
SqlDataAdapter ad = new SqlDataAdapter(s, c.getcon());
DataSet ds = new DataSet();
ad.Fill(ds);
if (ds.Tables[0].Rows.Count != 0)
{
xxx = ds.Tables[0].Rows[0][0].ToString();
string[] split = xxx.Split(',');
intArray1 = new int[split.Length];
for (int i = 0; i < split.Length; i++)
{
intArray1[i] = System.Convert.ToInt32(split[i]);
}
string xxxx = "select id,title from document where id in(";
for (int k = 0; k < intArray1.Length; k++)
{
xxxx += intArray1[k] + ",";
}
xxxx = xxxx.Substring(0, xxxx.Length - 1) + ") and category='" + drop_cat.SelectedItem.Value + "' and subctgry='" + drop_sub_cat.SelectedItem.Value + "' ";
string xxxx1 = "SELECT DISTINCT document.user_id, document.id, document_rights.bit_indicator, document.title FROM document CROSS JOIN document_rights where document.category='" + drop_cat.SelectedItem.Value + "' and document.subctgry='" + drop_sub_cat.SelectedItem.Value + "'";
SqlDataAdapter ad1 = new SqlDataAdapter(xxxx1, c.getcon());
DataSet ds1 = new DataSet();
ad1.Fill(ds1);
if (ds1.Tables[0].Rows.Count != 0)
{
foreach (GridViewRow di in GridView1.Rows)
{
CheckBox chkBx = (CheckBox)di.FindControl("CheckBox1");
}
}
GridView1.DataSource = ds1;
GridView1.DataBind();
}
}
please help me...
Thankss in advance...
Mitesh