0

hey all

can any one tell me how to insert a checkbox column in C1TrueDBGrid it is really showing me hell I am stuck in it.. Please please any one help

Thanks

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by bahed121
1

it seems really difficult to use C1TrueDBGrid at first but as you learn new things it looks easier day by day.... there are two ways to add checkbox column in a bound grid one to add the check box column in database or add in the dataset after getting values from database. Following code adds a checkbox column at the start of the table in dataset and then sets a checkbox column in c1TrueDBGrid1

//Code to connect to database
DbAdapter.Fill(dataSet1, tblName);
 dataSet1.Tables[0].Columns.Add("check_box", typeof(bool));
 dataSet1.Tables[0].Columns["check_box"].SetOrdinal(0);
                 
 c1TrueDBGrid1.DataSource = dataSet1.Tables[0];
//rest of the code for column setting
//code for checkbox column setting
 C1.Win.C1TrueDBGrid.ValueItemCollection check1 = c1TrueDBGrid1.Columns["Check_box"].ValueItems.Values;
c1TrueDBGrid1.Columns["Check_box"].ValueItems.Translate = true;
c1TrueDBGrid1.Columns["Check_box"].ValueItems.Presentation = C1.Win.C1TrueDBGrid.PresentationEnum.CheckBox;
check1.Add(new C1.Win.C1TrueDBGrid.ValueItem("0", false));
 check1.Add(new C1.Win.C1TrueDBGrid.ValueItem("1", true));
//CheckBox Column Presentation
c1TrueDBGrid1.Splits[0].DisplayColumns["check_box"].Width = 20;
c1TrueDBGrid1.Splits[0].DisplayColumns["check_box"].Frozen = true;
c1TrueDBGrid1.Splits[0].DisplayColumns["check_box"].Locked = false;
c1TrueDBGrid1.Columns["check_box"].Caption = "";

Edited by abelLazm: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.