I have a SqlDataSource that updates whenever a user specifies a value. I'm trying to do the following to update the gridview as well, but the gridview won't show anything. Did I miss anything here?
private void updateSessionGridView(string p)
{
session.SelectCommand = @"SELECT TOP 10 * FROM [MyDB]
where key = '" + p + "'";
GridView1.DataSourceID = null;
GridView1.DataSource = session;
GridView1.DataBind();
}
If you are using a data source control, then you need to set the DataSourceID property, not the DataSource property.