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

GridListControl or GridDataBoundGrid?

I''ll start by describing what I am trying to do: I want a listbox-style control with a few columns (typically 3 or 4) that does not slow down too badly with many rows of data. In the particular case I''m working with, I have about 1500-2000 rows of data. I have populated a DataTable and it is being used as the DataSource. The GridListControl seems to be the closest thing to what I want. However, I can''t mask out the undesired columns in the underlying data using DataTable.Columns, so I tried using GridDataBoundGrid. This doesn''t seem to support either AutoSizeColumns or FillLastColumn. Calling Model.ColWidths.ResizeToFit() on the VisibleCellsRange almost works, but I can''t get the last column correct. The sample at http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=34801 describes handling QueryColWidth, but even that doesn''t work correctly (run the sample application, and resize the row headers; the last column doesn''t repaint.) And calling ColWidths.GetTotal() doesn''t work right when row headers are disabled, as HeaderCount returns 0 but there''s still a size entry for the non-displayed column. I want the "sort by clicking on column" behavior of the DataBoundGrid; I can get an initial sort by setting DefaultView.Sort on the DataTable, but the GridListControl doesn''t have that behavior set up. I also want some of my cells to display a LinkLabel; the sample code to do that works for GridListControl, and I can set the same code up in the PrepareViewStyleInfo property on the DataBoundGrid. However, I can''t use my custom cell style as Grid.CellModels doesn''t exist as a member of DataBoundGrid, so the LinkLabel cell type is not recognized. What do I need to do to make this work?

2 Replies

AD Administrator Syncfusion Team February 22, 2006 10:43 AM UTC

Hi Ben, The GridDataBoundGrid can be tried since you want the custom cell types and sorting behavior. Please refer the attached sample to have the FillLastColumn\AutoFillColumn property in GridDataBoundGrid. The GridDataBoundGrid also have the CellModels through which the custom cell models can be added. Here is code snippet. this.gridDataBoundGrid1.Model.CellModels.Add("LinkLabelCell",new LinkLabelCellModel(this.gridDataBoundGrid1.Model)); Regards, Calvin.

41072.zip


BC Ben Carter February 22, 2006 11:23 PM UTC

The difference between this code and mine is that I have disabled the row headers by using the designer and setting Properties.RowHeaders to false. The example given sets Model.Cols.Hidden[0] = true. In my case calling ColWidths.GetTotal(0,0) returns 36 instead of 0 as in the supplied code. Is this a bug in the designer, or something internal to the grid?

Loader.
Live Chat Icon For mobile
Up arrow icon