I want to clear UltraGrid view Data on Clear Command

Dear Team,
I want to clear UltraGrid with tool clear command.
Any one has done it before .
I have updated data in UltraGrid through BAQ , but now I want to clear it with new form .
If I am trying to create new record then existing Grid not getting clear with new PackId.

private void epiButtonC2_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
EpiDataView partdv = ((EpiDataView)(this.oTrans.EpiDataViews[“SubShipD”]));
System.Data.DataRow
Partrow = partdv.CurrentDataRow;

I tried this but not working

myGrid.Rows.Clear();

1 Like

Is this a grid you created or an existing grid?

Is it bound to a datasource?

Yes , this is Grid which I have created and data load by Button. Working fine , No issue in that but When I go for another new packId then same Grid existed which I have created for previous PacKID.

It would be great , if you can assist , how can I clear grid or remove this Grid view and load fresh for new PackID.

If I clear form then this UltraGid also should be Clear

Set the datasource to null.

That would be great if you can help out with codes

myGrid.DataSource = null;

I used it but not working

Which event I need to select to execute it ?

AfterToolClick, “ClearTool” I think.

You may have to clear the datasource, then refresh the grid.

private void baseToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
{
    if (args.Tool.Key == "ClearTool")
    {
      epiUltraGridC2.DataSource = null;
		
    }
}
private void baseToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
{
    if (args.Tool.Key == "ClearTool")
    {
      epiUltraGridC2.DataSource = null;
      epiUltraGridC2.Refresh(); //? Maybe
    }
}

I tried this too
private void baseToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
{
if (args.Tool.Key == “ClearTool”)
{
epiUltraGridC2.DataSource = null;
epiUltraGridC2.Refresh(); //? Maybe
}
}

But not working , after clear the form , Grid exits

Message: --------compile errors------------
Error: CS1518 - line 516 (855) - Expected class, delegate, enum, interface, or struct

** Compile Failed. **