Hi,
I add two columns in ultragrid named "COL1","COL2" when form Load, and then I binding a datatable dt with only one column named "COL1" ,and SetDataBinding(dt, Nothing, True). at that time the grid showed data perfectly. and then I create another datatable dt2 with only one column name "COL2", and SetDataBinding(dt2, Nothing, True). Unfortunately, the grid lost the COL1, Why? How to always keep the columns that defined in the Form Load
I use win7/.NET 2010/Vol2013.1
Cheers!
Hi, Mike
It works well! Thanks.
Hi Jason,
Okay, I attached a quick little sample here for you. Click the buttons at the top to bind the grid to a DataTable with Column0, Column1, or both.
The InitializeLayout event check for the existence of each column and whichever column does not exist, it adds an unbound column for it.
Yes, you understand very correct!
I'd be happy to whip up some sample code for you, but before I do that, I just want to make sure I am clear on what you want.
Basically, you want the grid to always show the same two columns and you will be binding the grid to a data source that only has one or the other (or possibly both). Is that right?
If so, then basically what you will want to do is examine the columns inside the InitializeLayout event and check to see if it already exists. If it does, no problem, if it doesn't then you will add a new unbound column.
Does that sound right?
Hi,Mike,
I'm a new man in win ultragrid, could you give me some sample code for Initializelayout according to my request. thanks!
Jason