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,
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)
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; } }