Hi,
I have a problem because i'm rookie in .NET and Infragistics. My problem is this:
I have a UltraTabControl and I want to create new TAB in execution time, at time i need to insert one UltraGrid in each new TAB.
For example, i have a table with 5 countrys (c1,c2,c3,c4,c5)
I want on tab for country, but if i'll add a new country i need to appear this.
After that in each tab i ned a Ultra Grid to show all invoices that this country.
HELP i'm LOST!!!!!
Thanks.
When you bind the grid to a new data source, it has to no way to associate the rows from the original data source with the new rows in the new data source.
So the only way to do this would be for you to store the information yourself. You cannot store the row objects, either, since they will no longer exist in the new data source. You would have to store some primary key information for every expanded row, then loop through the rows after settings the new data source and look for the same rows to set their expanded state.
I have a question about this. Every time I set the datasource on the grid, it looses it's state (expanded rows). Is there a way to avoid this using the UltraTabStrip?
Which part of this are you lost on?
There are a couple of ways you can do this.
If you are going to have a lot of tabs, you might be able to save memory by using UltraTabStrip instead of UltraTabControl. Basically, UltraTabStrip simulates having lots of tabs, but there's really only one tab. So it appears to the user that there are lots of tabs, but the contents of the tab stay the same. So in this case, you would add all your tabs, or you could even bind the UltraTabStrip to a data source to create the tabs for you. Then you would just have a single grid on the TabStrip and you would trap the SelectedTabChanged event of the TabStrip and change the data source of the grid to match the active tab. This way you only have to create one grid and it saves a lot of resources.
The other method is to use UltraTabControl and create a grid on each tab. Creating tabs at run-time is pretty easy - you just use the UltraTabControl.Tabs.Add method. To place a control on a tab, you do something like this:
ultraTabControl1.Tabs[0].TabPanel.Controls.Add(myControl)