This seems like it should be so simple - but I can't get it to work. I have a RadGrid , using AjaxManager and NeedDataSource. I execute different queries - depending on the search criteria selected and return a dataset that is set to the DataSource:
this.RadGrid1.MasterTableView.DataSource = ds;
this.RadGrid1.MasterTableView.DataMember = ds.Tables.ToString();
This works great - however I have a clear button that I am trying to clear the grid with - the code is executed but the rows still are in the grid on the screen - I set the DataSource and DataMember to null and rebind.
void btnClear_Click(object sender, EventArgs e)
this.RadGrid1.MasterTableView.DataSource = null;
this.RadGrid1.MasterTableView.DataMember = null;
this.RadGrid1.DataSource = null;
So when that didn't work I thought I would manually try to remove the rows and I can't seem to find any RowsCollecion to iterate through and remove.
What am I missing here?? Any help is appreciated. Thanks!
Edited to add - I have EnableViewState set to True on the grid
Edited again - I was able to get the functionality I wanted by creating an empty table and setting the dataset to the datasource and the empty table to the datamember and then doing the this.RadGrid1.Rebind();
I would still be curious as to why setting the datasource and datamember to null would not work. It seems as though this functionality works when the NeedDataSource event is called automatically without having to do a Rebind.