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

GridDataBoundGrid and Row Headers

Thread ID:





7222 Sep 16,2003 03:40 PM UTC Sep 16,2003 05:55 PM UTC WinForms 2
Tags: GridControl
Peter Zaborski
Asked On September 16, 2003 03:40 PM UTC

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 04:43 PM UTC

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 05:55 PM UTC

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


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon