UltraWinGrid: How to refresh displayed data

alexpov picture alexpov · May 12, 2012 · Viewed 19.4k times · Source

i am new to infragistics and to winGrids

I have SQL database with the following table

Costumers
[ID][Name]

In addition , i have UserControl which has winGrid and add\remove buttons.

When the UserControll becomes, active winGrid datasource is bounded to the table

winGrd.DataSource = Tables.Costumers;

When user wants to add\remove data from costumers table he clicks the relevant button. The table is changed accordingly but the displayed data in the grid is not changed. I used

winGrd.Refresh();

but it does no effect

what is the way to do this, Code examples are welcome

thanks

---Edited ---- Adding code:

private void BtnAdd_Click(object sender, System.EventArgs e)
{
        //...

        DB.DataProxy.AddCostumer(txtType.Text);
        winGrd.Refresh();

        //...
}

AddCostumer method eventually calls for the following method that updates the costumer table

public void AddCostumer(string type)
{
        Costumers.InsertOnSubmit(new InsertOnSubmit{ Name = name});
}

Answer

Danko Valkov picture Danko Valkov · May 13, 2012

If your DataTable is being updated, the UltraGrid should be showing those changes for you. What you could try is to call

ultraGrid1.Rows.Refresh(Infragistics.Win.UltraWinGrid.RefreshRow.ReloadData);

or

ultraGrid1.Rows.Refresh(Infragistics.Win.UltraWinGrid.RefreshRow.RefreshDisplay);