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();
}
如果使用的是数据源控件,则需要设置DataSourceID属性,而不是DataSource属性。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.