I have a problem with the ultrawingrid which I am using in my application.
a)Post the databind, the properties i set in the ultragrid designer for my bound columns, such as a 'hidden' property or 'no edit' property, they are lost on refreshing this grid (refresh being done by another database call which loads up the data).
- Is there a way i can retain this? I am currently working around this by doing this after the databind call.
Me
.grdName.DisplayLayout.GroupByBox.Hidden = True
.grdName.DisplayLayout.Bands(0).Columns(0).Format = "Someformat"
This appears to work fine. However, once in a while(say 1 time out of 10) I am getting an IndexOutOfRange Exception which, when i debug with my CLR exceptions to thrown, i am getting the columns(0), or columns(1) as nothing. Definitely not desirable. Is there a way I can manually work around this? Maybe put this in an event of some kind(like a databound event which i can see in the ultrawebgrid)?I am rather new to using infragistics controls and I'd greatly appreciate any help in this regard.Thanks a lot! Cheers!
HOWTO:How can I define columns in the grid at Design-time and bind them at run-time so that some fields of the data are excluded from the grid?
The IndexOutOfRange exception is probably an issue of timing. What event are you using for this code? The best event for code like this is the grid's InitializeLayout event.
Hmm I did not put it in the initialize layout code. Actually, i think the problem is related to the datagrid actually 'grabbing' data from the source across threads.I alleviated this by using a threadsafe method, and the invoke required property, the usage of which, was well explained in another infragistics thread. So far, i think its working just fine. On a related note,Is there any reason why , in the initializerow event of an ultragrid, only sometimes i find that when i try to access the cells using e.Row.Cells(0) or cells(1), i get another index out of range exception? I would assume the initialize row event would occur only after the row is added to the grid. I have put in some defensive code to prevent this exception, however, i still get it, albeit very rarely.
Private Sub grdName_InitializeRow(sender As Object, e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles grdName.InitializeRow
<<Defensive code if statement>>
<<Doing something on e.Row.Cells(2)>>
<<End defensive code check>>
Any pointers how to get around this? Maybe put this in another event like the initializegridlayout or something else? Thanks!