
























如何查找GridView的EmptyDataTemplate中的控件
网上看了很多用Controls[0].Controls[0]的方法,也很有道理,不过在有数据的情况写可能出出现Null异常,
这时你可以试试下面的方法,我感觉非常好用。
protected void GridViewSearchResult_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.EmptyDataRow)
{
((Label)(e.Row.FindControl("LabelKeyword"))).Text = Request["keyword"];
}
}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。