When the page loads, it populates the UltraWebGrid with available data. I want to give the customer the option to clear everything so they can start with a fresh empty grid. I am trying to find a way to clear the data either client side or server side.
thanks.
Hello,
It really depends whether you are binding the grid in bound or unbound mode, and if you are in bound mode, are you using DataSourceID and use a declarative datasource (like AccessDataSource, LinqDataSource, etc) or are you using DataSource with a runtime datasource like DataTable, business object, etc?
Also, are you using InitializeDataSource event (it gets automatically called when grid needs rebinding, so it may override some of the custom actions you do, depending on where in the page lifecycle you are using them.
Something you can try is setting DataSourceID to String.Empty and/or DataSource to null and then call DataBind() explicitly. Alternatively, you can create a very simple empty DataTable and bind the grid to it (just with the columns you need)
e.g.
private DataTable CreateEmptyDataTableWithSchema() {
}
....
UltraWebGrid1.DataSource = CreateEmptyDataTableWithSchema();
UltraWebGrid1.DataBind();