Hello,
on a form I had a UltraWinDataSource that is bound to an UltraWinGrid and some standard Label controls (on the grid I show some relevent information (columns) and in the lables more informations(columns) from the datasource.If I open the form at the first time, I avoid the default selecting of the first row in the grid in the AfterRowActivate event (deselect the active row).void ctlGrid_AfterRowActivate( object sender, EventArgs e ){ if (bInitComplete == false) { If (ctlGrid.ActiveRow != null) ctlGrid.ActiveRow = null; } bInitComplete = true;}
This works good. But the label controls, that I had bind to the data source with DataBindings are display the values of the "normaly" default first row selection. I'am try to find a (if possible easy) way to have empty label controls until the user selects any row in the grid.
I'am using the V11.1.20111.1003.
Hi,
The behavior you are seeing here isn't really anything to do with the grid or the labels. When you use DataBinding, the BindingManager in DotNet will automatically position to the first row of data.
So the grid synch's up it's position by setting the activerow. You can turn this off in the grid by setting SyncWithCurrencyManager to false. Of course, this is an ongoing process, and this means that changing the active row in the grid will not change the position of the BindingManager and the labels will not update when you do actually activate a grid row. So you probably don't want to do that.
As far as I am aware, there is no way to stop a bound Label control from showing the data in the current row of the BindingManager - except of course to not bind the controls in the first place.
You might want to check Microsoft's documentation for the BindingManagerBase and/or CurrencyManager and see if there is a way. Or post on a more general DotNet programming forum to see if someone else has come up with a solution for this.
Hi Mike,
I unterstand. Your answer was very helpfully. Now I'am thinking about, to bind the controls on runtime, after the first row was selected in the grid.
Thanks.
Are you alright now? Do you have any other questions?
I am new to your your datagrid. Could you please tell me where is the menu and sample I can learn by myself? Especially, how to update database after adding a new row and how to delete a row?