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

Getting row numbers in the data-bound grid

Thread ID:





70084 Nov 26,2007 05:43 PM UTC Nov 27,2007 08:55 AM UTC WinForms 1
Tags: GridControl
Asked On November 26, 2007 05:43 PM UTC

I've been evaluating the Syncfusion grid controls, and was surprised to find that in the data-bound grid, there's no simple way to get row numbering (in the header). Is this not possible?

Also, I don't understand why there was the need to split your class hierarchy into 2 separate classes - one for the normal grid, and one for the data-bound grid. The normal grid has several UI properties that don't seem to be there in the data-bound grid.

So anyone wanting the best of both worlds has to either :-

1) take the data-bound grid and then write a lot of extra code so it looks as good as the normal grid (specially if you want excel like features)

2) take the unbound grid and do your own data binding code

Seems to me that that's a lot of extra work considering people'd buy a 3rd party grid to save on some development time.

Am I missing something obvious here?

Administrator [Syncfusion]
Replied On November 27, 2007 08:55 AM UTC

If you are referring to GridControl and GridDataBoundGrid, they do derived from the same class GridControlBase. They do both have the same property grid.Model which does hold lots of common properties. Their main difference is that one is a cell oriented grid (storing all information and properties on a cell by cell basis in its own data cache) and the other is a bound, column oriented grid which does not have a local datastore setup to store any information on a cell by cell basis. The idea is that for bound data which might be millions of records with similar data in each column, there is no need to allocate the overhead required to manage cell by cell data in such cases.

If you want to see the row numbers in a GridDataBoundGrid, here is one way. Subscribe to the Model.QueryCellStyleInfo event.

this.gridDataBoundGrid1.Model.QueryCellInfo += new GridQueryCellInfoEventHandler(Model_QueryCellInfo);

Then use code like this in the handler.

void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
if (e.RowIndex > 0 && e.ColIndex == 0)
e.Style.CellType = "Header";
e.Style.Text = e.RowIndex.ToString();
e.Style.Font.Bold = false;
e.Style.CellTipText = e.Style.CellType;


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