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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dynamic resize of the GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

11992 Mar 19,2004 09:40 AM UTC Mar 19,2004 10:44 AM UTC Windows Forms 3
loading
Tags: GridControl
Milos Sommer
Asked On March 19, 2004 09:40 AM UTC

Hello, I would like to ask you what all I need to do in order to get dynamically (run-time) resizeable GridDataBoundGrid? I tried some experiments with it. Unfortunatelly not always sucessfully. Sometimes I loose a row(s) or column(s). Thank you for your help.

Administrator [Syncfusion]
Replied On March 19, 2004 10:30 AM UTC

If you anchor the grid on all 4 sides, it will will size automatically. Are you referring to trying to size the colwidths and rowheights to try to always fully occupy the client area of the grid? If so, then what is it that you want to happen? Do yo uwant the cells to size proportionally to fill teh client area? Or, do you want the right hand column to grow to fill teh space or ???. You do this by handling the QueryColWidth event and dynamically setting the e.Size value there depeding upon the Index passed in. Take a look at the grid\samples\databound\GridDataBoundImageCell sample. It has a grid cells that size proportionally. If you want to fill the right column, check this forum thread. There is a sample posted there in one of the responses. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=2699

Milos Sommer
Replied On March 19, 2004 10:36 AM UTC

Sorry for my poor problem explanation. I need to change the number of rows and columns of the grid. Thank you. >If you anchor the grid on all 4 sides, it will will size automatically. > >Are you referring to trying to size the colwidths and rowheights to try to always fully occupy the client area of the grid? > >If so, then what is it that you want to happen? Do yo uwant the cells to size proportionally to fill teh client area? Or, do you want the right hand column to grow to fill teh space or ???. > >You do this by handling the QueryColWidth event and dynamically setting the e.Size value there depeding upon the Index passed in. > >Take a look at the grid\samples\databound\GridDataBoundImageCell sample. It has a grid cells that size proportionally. > >If you want to fill the right column, check this forum thread. There is a sample posted there in one of the responses. > >http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=2699

Administrator [Syncfusion]
Replied On March 19, 2004 10:44 AM UTC

In a GridDataBoundGrid, you would normally add rows and/columns directly to the datasource using whatever is appropriate for your datasource. If it is a DataTable, you could use DataTable.Rows.Add and DataTable.Columns.Add. Now rows added should normally just automatically appear as the grid is listening to events to respond to this type of action. This depends on your datasource. It must support IBindingList for this to happen automatically. Adding columns is a differernt process since not all columns get automatically shown in the grid. To handle this, I would make sure I am using the grid.GridBoundColumns collection for my initial display (either populate through code or through teh designer). Then to add a column, you would first add it to the DataSource. Then create a GridBoundColumn with the proper MappingName and add it to the collection. Then call grid.Binder.InitializeColumns to make the grid reset itself to use the column.

CONFIRMATION

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.

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

;