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. Image for the cookie policy date
close icon

GDBG Cell formatting

Hi, I need to do the following: - Set autosize = on for all cells in the GDBG. - Decrease the height of certain rows/cells in the GDBG. - Insert line separators after every 6 rows in the GDBG If anyone knows how any of these can be done, please let me know. Thanks

6 Replies

AD Administrator Syncfusion Team August 29, 2005 08:12 AM UTC

- Set autosize = on for all cells in the GDBG. grid.TableStyle.AutoSize = true; - Decrease the height of certain rows/cells in the GDBG. Subscribe to the grid.Model.QueryRowHeight event. In your handler, if e.Index points to a row wher eyou want to set a size, then set e.Size to be the size you want, and also set e.Handled = true; - Insert line separators after every 6 rows in the GDBG I do not know of an easy way to do this. You can add a special cell border using PrepareViewStyleInfo. Here is a sample showing the last 2 points. http://www.syncfusion.com/Support/user/uploads/GDBG_Delete_11d18467.zip


AP Atith Pagdi August 29, 2005 11:40 AM UTC

What''s the subroutine signature for this.dgTest.Model.QueryRowHeight +=new GridRowColSizeEventHandler(Model_QueryRowHeight) Is it private void Model_QueryRowHeight(object sender, GridQueryCellInfoEventArgs e) If it is, I get e.Style attribute. How do I set the height attribute for e? Thanks


AD Administrator Syncfusion Team August 29, 2005 11:44 AM UTC

Here is the code from the sample I gave you.
private void Model_QueryRowHeight(object sender, Syncfusion.Windows.Forms.Grid.GridRowColSizeEventArgs e)
{
	if((e.Index % 3) == 1)
	{
		e.Size = 40;
		e.Handled = true;
	}
}
The sample runs fine for me. Did it not run for you? There is no e.Style in the Grid.GridRowColSizeEventArgs e argument.


AP Atith Pagdi August 29, 2005 02:16 PM UTC

Hey it works! Thanks... What about having a line separator? how would I do it in PrepareViewStyleInfo? Do you have a sample? Also, I set the TableStyle.AutoSize property to true in the design view, but when the text is too long in a cell, it just gets cut off and the cell doesn''t expand vertically. Any idea why this is happening? Do I need to explicitly set it in the code behind?


AD Administrator Syncfusion Team August 29, 2005 02:29 PM UTC

Did you look at the sample? It had border styles set in PrepareViewStyleInfo. Autosize only works as your user types. If you set text into a cell programmatically, then autosize will not affect this. Instead, you will have to explicitly call grid.Model.ColWidths.ResizeToFit to make the columns become wider so the text will fit. If you are doing this in Form.Load before the grid is visible, then you also need to set grid.AllowResizeToFit = false;


AP Atith Pagdi August 30, 2005 07:42 AM UTC

Thanks! That solves all my problems.

Loader.
Live Chat Icon For mobile
Up arrow icon