Depends if you want to keep the column headers. If not, you could just
create an empty data source and bind. :)
DataTable dt = new DataTable();
// Create columns here..
DataGrid1.DataSource = dt;
DataGrid1.DataBind();
Or you could set DataGrid1.EnableViewState = false, and repost the page..
You could even do SELECT * FROM myTable WHERE myId = 0 and fill the data
source, then you'd have the columns, but no data..
The possibilities are many ;)
Lars-Erik
"Grant Merwitz" <gr***@workshare.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
so DD2.Items.Clear() works perfectly on a dropdown
but hows about a DataGrid?
"Grant Merwitz" <gr***@workshare.com> wrote in message
news:OM****************@TK2MSFTNGP10.phx.gbl... How do you unbind one of these web controls.
I have a drop down list that based on another drop down list selection
will be databouns
private void BindDD2(int id)
{
DD2.DataSource = MyClass.GetList2(id);
DD2.DataBind();
}
Now, if i want to reset this drop down back to its pre bound state, how
would i do this.
I've tried:
1)
DD2.DataSource = null; //didn't work
2)
foreach(ListItem l in DD2.Items)
DD2.Items.Remoce(l); //also don't work
3)
DataSet ds = new DataSet();
DD2.DataSource = ds;
DD2.DataBind(); //this throws an error.
So, any ideas
TIA