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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Default headers in data bound grid

Thread ID:

Created:

Updated:

Platform:

Replies:

11507 Mar 9,2004 09:30 AM UTC Mar 10,2004 02:34 PM UTC WinForms 3
loading
Tags: GridControl
Samuel Jack
Asked On March 9, 2004 09:30 AM UTC

Hello, I''m using a data bound grid to display a DataTable. Is it possible (in Beta 2) to display automatically the default row and column headers (ie "A", "B", "C",... for the columns, "1", "2", "3", ... for the rows) in addition to the headers added by the DataBound Grid?

Administrator [Syncfusion]
Replied On March 9, 2004 11:55 AM UTC

Do you want a second row of column header (and second column of row headers), or do you want to combine the desired text into a single header (maybe A-MyColumn 1, B-MyColumn2 etc). If you want two header rows, then you can set this.grid.Model.Rows.HeaderCount = 1; this.grid,Model.Rows.FrozenCount = 1; Then in aPrepareViewStyleInfo event handler, based on the value of e.ColIndex, you could explicitly set the e.Style.Text when e.RowIndex was 0 or 1. To convert e.ColIndex to a letter of the alphabet, you can call the static (Shared in VB) member GridRangeInfo.GetAlphaLabel method. Here is a little sample to give you the flavor of the kinds of things you can do. forum11507_4520.zip

Samuel Jack
Replied On March 10, 2004 01:58 PM UTC

Thanks for that, it seems to work fine. What about for the Row Headers? I want to have numbers 1, 2,3, ... down the side of the grid.

Administrator [Syncfusion]
Replied On March 10, 2004 02:34 PM UTC

If you are handling PrepareViewStyleInfo as in the prevoius sample, you can add this else clause to the if to get teh numbers down the side. else if(e.ColIndex == 0 && e.RowIndex > 0) { e.Style.CellType = "Header"; e.Style.Text = e.RowIndex.ToString(); e.Style.Font.Bold = false; }

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.

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

;