We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Checkbox in header cell

Thread ID:





11348 Mar 3,2004 11:46 AM UTC Mar 3,2004 01:27 PM UTC WinForms 4
Tags: GridControl
Philip Bishop
Asked On March 3, 2004 11:46 AM UTC

I''m trying to make a grid with 2 row headers and the 2nd row header needs to have checkboxes in them. So i set the.... GridControl1.Rows.HeaderCount = 1 GridControl1.Rows.FrozenCount = 1 Then I go to the ide and click the grid then go to the rowstyles property. I change row1 celltype to checkbox. On the grid in the ide it puts the check box in each cell in row 1 like I would think. When I run they just come up as empty row headers with no check box. If i add this line of code in the load proc... GridControl1(1, 1).CellType = "CheckBox" Then I actually see the checkbox in row1 col1. What exactly does the rowstyles celltype property that i was setting do??? Nothing?? Thank you Phil

Philip Bishop
Replied On March 3, 2004 11:56 AM UTC

One other thing i just noticed. If i commment out the following lines, more so the first one then i can set the celltype in the ide to checkbox works fine. '' GridControl1.Rows.HeaderCount = 1 '' GridControl1.Rows.FrozenCount = 1 So i thought ok maybe its just a design time thing. So I umcommented the previous lines and added this line. GridControl1.RowStyles(1).CellType = "CheckBox" Then it doesnt work again. So its like the grid doesnt want u to set a whole row at once to check box if u have locked down another row to be a header as i''ve done, but it will let u loop through and set each cell one by one as i showed u in my last post. Let me know Thank you Phil

Philip Bishop
Replied On March 3, 2004 12:22 PM UTC

Ok and now one other thing. If i go through a loop like i said to set each indivual column in the row to a check box like this... For i = 1 To 32 grdNBSSP(0, i).CellType = "CheckBox" Next Then what happens is i get checkboxes in all the colums in row0 but it gets rid of the seperator between each cell so it looks like its one big cell with checkboxes in them. If I do this in the NON COLUMN header rows it works fine and displays each cell with a break then the next cell in that row and so on. I can attach a sample to show u this. column header_8716.zip Thanks again Phil

Administrator [Syncfusion]
Replied On March 3, 2004 12:50 PM UTC

By default column header cell styles are determined by grid.BaseStylesMap("Column Header"), and this setting takes precedence over rowstyle settings. This is by design. So, if you want both your header rows to be checkboxes, you could set: Me.GridControl1.BaseStylesMap("Column Header").StyleInfo.CellType = "CheckBox" But since you only want one of the rows to be checkboxes, and you cannot use a RowStyles to change the celltype if you make the row a header row. If you want the top row to be checkboxes, then you will have to loop through the cells setting the style cell by cell. If you want the second row to be the checkboxes, then you could just freeze the row using FozenCount, but do not make it a header (don''t set HeaderCount). Then the RowStyles for the row will not be superceded by the Column Header basestyle. The reason you lose the border when you change the Column Header celltype to checkbox is that header cells do not have a border. Instead, the cell control draws the cell with a 3d appearance (This makes the header look more like a button.). So, if you want your checkbox ''header'' cells to have the same appearance, then you should set the CellAppearance style property. GridControl2(0, i).CellType = "CheckBox" Me.GridControl2(0, i).CellAppearance = GridCellAppearance.Raised

Philip Bishop
Replied On March 3, 2004 01:27 PM UTC

Once again Clay, you''re the man. Thanks for the unbelievably fast response time. Phil


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon