Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
UltraWinDataSource - DataBinding to Controls
posted

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)
 {
   I
f (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.

Parents
  • 469350
    Suggested Answer
    Offline posted

    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.

Reply Children