Click here to Skip to main content
15,890,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,

I have one requirement. I want to put a checkbox in a datagrid, not in datagridview.

I created datagrid table like below.
please give me any idea.

    DataTable dt = new DataTable("MyDataTable");
    //Create columns and add to DataTable;
    DataColumn dcID = new DataColumn("R_NAME");
    dt.Columns.Add(dcID); //ID column created and add to DataTable
    DataColumn dcSomeText = new DataColumn("R_Check");
    dt.Columns.Add(dcSomeText); //LastName column created and add to DataTable
    //Now Add some data to the DataTable
    DataRow dr;
    string[] str11 =new string[ ds.Tables[0].Rows.Count-1];

    for (int i = 0; i <= str11.Length; i++)
    {
        dr = dt.NewRow();
        //str11[0] = ds.Tables[0].Rows[i][1].ToString();

        dr["R_NAME"] = ds.Tables[0].Rows[i][1].ToString();
        dr["R_Check"] = ds.Tables[0].Rows[i][2].ToString() + i;

        dt.Rows.Add(dr);

    }
    return dt;
}

please modify and send me the solution.

Thanks
Venkat.S
Posted
Updated 23-Jun-11 3:01am
v2

when i type DataGridBoolColumn

thats not appear please give any idea
 
Share this answer
 
Comments
Shahriar Iqbal Chowdhury/Galib 23-Jun-11 17:22pm    
no a solution, its a comment.
 
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