I am using Infragistics UltraGrid with BindingList. My bindingList gets populated by a stored procedure based on the inputs from the users. Users can select values which fires the stored procedure and repopulates the BindingList with new values.Every thing works fine except that the ultragrid doesn't get refreshed with this new set of values. Please suggest.
Hi Mike,
I have an ultra win grid and when i am trying to refresh grid, i can see in code that latest data is binding to grid but UI is not refreshing with latest data.
I tested with all different scenarios.
I am doing like this ;
Grid.DataSource = List <T>;
Grid.Rows.Refresh(RefreshRow.ReloadData,true);
Grid.Rows.Refresh(RefreshRow.RefreshDisplay, true);
Grid.Rows.Refresh(RefreshRow.FireInitializeRow, true);
Where <T> is a List which also contains another List for child grid.
I also changed list to Binding list , still doesn't work.
Okay...
'binding' in the code you have here is a variable. All you are doing is assigning a new BindingList to the 'binding' variable. The grid is still bound to the original data source which has not changed. In other words, you are not changing the list the grid is bound to - you are creating a new list which has no connection to the grid.
Thanks but grid.Rows.Refresh(ReloadData) doesnot work either. I am reloading the data on the button click event and trying to refresh the grid.
public partial class Form1 : Form { BindingList<Emp> binding = new BindingList<Emp>(); public Form1() { InitializeComponent(); binding = LoadData(); ultraGrid1.SetDataBinding(binding, null); }
private void ultraButton1_Click(object sender, EventArgs e) { binding = LoadData1(); ultraGrid1.Rows.Refresh(Infragistics.Win.UltraWinGrid.RefreshRow.ReloadData); }
BindingList<Emp> LoadData() { BindingList<Emp> returnList = new BindingList<Emp>(); returnList.Add(new Emp { Name = "Joe" }); return returnList; }
BindingList<Emp> LoadData1() { BindingList<Emp> returnList = new BindingList<Emp>(); returnList.Add(new Emp { Name = "John" }); returnList.Add(new Emp { Name = "James" }); return returnList; } }
public class Emp { public string Name { get; set; } }
Hi,
How are you refreshing your BindingList? If you use the Add method, then this will notify bound control that a new row was added. If you are using some other method, and the grid is not updating itself, then you must be somehow bypassing the BindingList's notifications.
In that case, you should be able to refresh the grid by calling:
grid.Rows.Refresh(ReloadData)