我想實現(xiàn)的功能:當(dāng)我點擊查詢時才顯示DataView,不點擊時則不顯示,這樣的功能怎么才能實現(xiàn)?
1 回答

幕布斯7119047
TA貢獻1794條經(jīng)驗 獲得超8個贊
將你的數(shù)據(jù)綁定方法放在查詢按鈕的單擊事件里面調(diào)用就可以了。
private void BindDate()
{
DataTable dt = new DataTable();
dt.Columns.Add("ID", typeof(int));
dt.Columns.Add("Name", typeof(string));
dt.Rows.Add(1, "zhang");
dt.Rows.Add(2, "zhao");
dt.Rows.Add(3, "jia");
dt.Rows.Add(4, "li");
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
}
protected void Unnamed1_Click(object sender, EventArgs e)
{
BindDate();
}
- 1 回答
- 0 關(guān)注
- 226 瀏覽
添加回答
舉報
0/150
提交
取消