我在GridView中有过滤数据的问题。我想排除一些变量,如果我想回到以前的GridView,它不想显示所有值。你有什么想法吗?
提前致谢!
//i check if there is a value in textbox that filter me a Grid
if (!string.IsNullOrEmpty(whatToFilter))
{
dt.DefaultView.RowFilter = " Some_Column NOT LIKE '%" + TextUnFiltrAgg.Value + "%'";
AggregateGridView.DataSource = dt;
AggregateGridView.DataBind();
txtCountNumRows.Text = string.Format("{0:#,##0}", dt.DefaultView.Count);
}
else
{
DataTable dtSession = (DataTable)Session["DataTable"];
AggregateGridView.DataSource = dtSession;
AggregateGridView.DataBind();
txtCountNumRows.Text = string.Format("{0:#,##0}", dt.Rows.Count);
}
}
答案 0 :(得分:0)
嗨,
当您不想过滤时,只需清除文本框TextUnFiltrAgg的值。
感谢名单。