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

exception when writing to a grid cell

Thread ID:





77628 Nov 10,2008 09:46 PM UTC Nov 13,2008 01:06 PM UTC WinForms 3
Tags: GridControl
Andy Chan
Asked On November 10, 2008 09:46 PM UTC


I am having a problem when writing to the row header when I use the following line of code:
" this._grid[i, 0].CellValue = rowCount.ToString(); "

I'm simply trying to programmaticaly enumerate this column(0) with a number. But when I make a call to the CellValue, my rowIndex is returned as out of range and an exception is thrown.

i = 2
grid.RowCount = 8

Is there a reason why my grid is upset with accessing this row?

Thanks in advance.

Nisha Arockiya A [Syncfusion]
Replied On November 11, 2008 06:46 AM UTC

You can try handling the PrepareViewStyleInfo event of the grid to get numbered row headers.

private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
if (e.ColIndex == 0 && e.RowIndex > 0)
e.Style.Text = e.RowIndex.ToString();
e.Style.BaseStyle = "Header";
e.Style.Font.Bold = false;

Here is a small sample for reference.

Please let me know if this serve your needs.


Andy Chan
Replied On November 11, 2008 01:38 PM UTC


Thanks for the reply. I'm building a grid which populates with vector data. Vector data is not always a 1:1 association so numbering row columns this way is not ideal. I have a separate method in which the code above is throwing an exception... the debug window I have says that it's a Syncfusion ... SetItem() method that is throwing an error.

Any Ideas?

Nisha Arockiya A [Syncfusion]
Replied On November 13, 2008 01:06 PM UTC

Hi Andy,

Thanks for your Updates.

Could you please provide the exception details or the stack, so that it will be very halpful for us to direct you to the exact solution on time?? We appreciate your patience.



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

or the page will be automatically redirected to 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