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

Dynamic resize of the GridDataBoundGrid

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.

3 Replies

AD Administrator Syncfusion Team 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


MS Milos Sommer 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


AD Administrator Syncfusion Team 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.

Loader.
Live Chat Icon For mobile
Up arrow icon