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.

GridDataBoundGrid and Row Headers

Thread ID:

Created:

Updated:

Platform:

Replies:

7222 Sep 16,2003 11:40 AM Sep 16,2003 01:55 PM Windows Forms 2
loading
Tags: GridControl
Peter Zaborski
Asked On September 16, 2003 11:40 AM

I'm trying to create a databound grid which uses a DataTable as its DataSource (ie. grid.DataSource = myDataTable;). It's a readonly grid BTW, no edits allowed. I'd like to somehow make the grid's row header text be the values of my DataTable's column 0 values. The default behavior seems to be that the grid uses column 0 for a row header and column 1 for the first DataTable column. I've managed to do what I want by hiding the grid's column 1 and in the PrepareViewStyleInfo handler I copy the contents of column 1 to column 0 (the row header) for each row. This seems like a huge hack. Is there a more elegant way of forcing the DataBoundGrid to use my DataTable's first column as the row header values? Any insights appreciated. -Peter

Administrator [Syncfusion]
Replied On September 16, 2003 12:43 PM

Here is something to try. Hide the default row header (col 0). Then set: this.grid.Model.Cols.FrozenCount = 1; This should prevent your column 1 from scrolling and it should just display your column 1 values as a fixed column. If you want the cell to appear like a header cell, then set: this.grid.Binder.InternalColumns[0].StyleInfo.CellType = "Header";

Peter Zaborski
Replied On September 16, 2003 01:55 PM

Good stuff, that did the trick. Thanks. -Peter

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.

;