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.

GridListControl or GridDataBoundGrid?

Thread ID:

Created:

Updated:

Platform:

Replies:

41072 Feb 21,2006 08:44 PM Feb 22,2006 06:23 PM Windows Forms 2
loading
Tags: GridControl
Ben Carter
Asked On February 21, 2006 08:44 PM

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?

Administrator [Syncfusion]
Replied On February 22, 2006 05:43 AM

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

Ben Carter
Replied On February 22, 2006 06:23 PM

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?

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.

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.

;