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.

out of range error

Thread ID:

Created:

Updated:

Platform:

Replies:

8345 Nov 3,2003 07:04 AM Nov 3,2003 09:25 AM Windows Forms 3
loading
Tags: GridControl
Per Millard
Asked On November 3, 2003 07:04 AM

I have a problem when I try to access my cellstyleinfo. When I try to access them using ex. Grid[0,2] I get an out of range in colindex exception although the number of rows and cols far exceed 0 and 2. Other examples seems to work just fine, so it must have something to do with my grid setup. Any ideas ? Regards Per Millard Senior Software Architect PBJ Consult A/S

Administrator [Syncfusion]
Replied On November 3, 2003 07:11 AM

Are you using a GridControl, or a GridDataBoundGrid? If you are using a GridDataBoundGrid, then use the GridBoundColumn[col].HeaderText property to get/set the header text. If you have dynamically changed the row/column count of a GridControl at runtime, also make sure you call grid.ResetVolatileData. If you cannot spot something, if you can post a little sample project showing the problem, we should be able to spot something here.

Per Millard
Replied On November 3, 2003 07:58 AM

Hi Clay It seems that I manually set RowCount and ColCount to 0 at grid creation and subsequently supplied them in the Query event handlers. Not resetting the values when creating the grid seemed to eliminate the error. However, I still have a problem changing the style properties outside the QueryGridInfoHandler event handler. No matter what I try to change, be it cellstyle, cellvalue etc., the changes are just ignored. Again, this works fine in a simple example, but in my applikation, the grid ignores ex. Grid[0,2].CellType="Static" Any ideas ? > Are you using a GridControl, or a GridDataBoundGrid? > > If you are using a GridDataBoundGrid, then use the GridBoundColumn[col].HeaderText property to get/set the header text. > > If you have dynamically changed the row/column count of a GridControl at runtime, also make sure you call grid.ResetVolatileData. > > If you cannot spot something, if you can post a little sample project showing the problem, we should be able to spot something here.

Administrator [Syncfusion]
Replied On November 3, 2003 09:25 AM

You mentioned QueryCellInfo. Do you have code like if(e.ColIndex > 0 && e.RowIndex > 0) {// to prevent trying to set values when e.RowIndex == 0? You should if you want the grid to provide these values from its store. Also, are you handling SaveCellInfo? If so, you should not be setting e.Handled = true when e.RowIndex == 0. If you do this, it will prevent the grid from saving the changes for row 0 to its data store. If you are dynamically providing the rowcount through QueryRowCount for a virtual grid, you can also try setting grid.Model.Data.RowCount = 1 so the grid will allocate the storage for this header row.

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.

;