Hi
following code:
----this.Grid.BeforeRowActivate += new Infragistics.Win.UltraWinGrid.RowEventHandler(this.MainUltraGrid_BeforeRowActivate);
bs = new BindingSource();bs.DataSource = this.DataSet;bs.DataMember = "MyTable";-----
Now, when I set the DataSource to my dataset (right before I set the DataMember of my BindingSource).the BeforRowActivate Events gets fired and the UltraGrid is bound to the first table in my DataSet's Table Collection.
Does the Ultragrid automatically bind to the first table or is that the BindingSource's behaviour. If the Ultragrid does this, is there any way to prevent this?
Hi,
If the grid is returning 0 rows, then I doubt that this is an issue with the grid. It sounds to me like your data source is blowing up and getting corrupted somehow.
Just as a test, try binding a DataGridView to the same data source and see if it shows the same results. If so, then that would confirm that the DataSource is the problem.
I'm really not that familiar with EF, but what you are doing in the save button doesn't seem right to me. Why are you calling EndEdit on the BindingSource and then EndCurrentEdit on the CurrencyManager, too? I would think the former would implicitly do the latter and it would not be necessary to do both.
Sorry my bad :( ,it's "Click on any control"
I checked the problem and figure out that when changing the value of some of the controls (like UltraCombo,CheckEditor,...) that are binding to the same BindingSource of the grid , the data in the grid disappear .
I also checked the "Grid.Rows.count()" after the data disappear and it's giving "0 rows"
As i mentioned before i'm using EF 4 where i'm doing the following
_Context = Employee.Model.EDMACTEntities();
bindingsource1.DataSource = _Context.tbAREmployee.Where(x => x.AREmployeeID == 1320) ;
then i'm doing the binding of the ultragrid with the following code
ChildrenInfoGrid.SetDataBinding(bindingsource1,"tbPrEmpHistory");
and for the other controls like
ultratexteditor : FNameText.DataBindings.Add("Text",bindingsource1,"FName");
ultracheckeditor : ActiveCheck.DataBindings.Add("Checked,bindingsource1,"Active");
.....................
and adding a Save button with an click_event which include the following code
try
{
bindingsource1.EndEdit();
bindingsourc1.CurrencyManager.EndCurrentEdit();
_Context.SaveChanges(SaveOption.DetectChangesBeforeSave);
}
and i'm not able to fix this problem
so plz any help
Thanks In Advance
What do you mean by "click on any controller?" What's a controller? I'm guessing that's a typo and you meant "control?"
I can't imagine any reason why that should happen. Can you reproduce the issue in a small sample project and post it here so we can check it out?
Try setting the IDE to break on all run-time exceptions. Maybe something is blowing up behind the scenes and it's being caught so you aren't seeing it.
Try checking the grid.Rows.Count after the data disappears. That will tell us if the grid has actually lost the data or if the data is there and something is wrong withj the grid's display.
I've used the SetDataBinding method to bind a the UltraGrid
to a bindingsource that contains an collection of entities
like this
bindingSource1.DataSource = _context.tbAREmployee .Include("tbPrEmpChildren") .Where(x => x.AREmployeeID == 1320);
ChildrenInfoGrid.SetDataBinding(bindingSource1, "tbPrEmpChildren");
it is working fine upon the load of the windows form and it's displaying data but the problem is when
i click on any controller in the form the data in the UltraGrid disappears ,
is there's any code that i'm missing ?
I'm using Infragistics V12.2 with EF 4
Hi, sorry for the late response.
thanks for the help