日期:2014-05-18  浏览次数:20490 次

请问gridview中pagertemplate中的checkbox如何获得
GridViewer1中PagerTemplate
....
  <PagerTemplate>
  <asp:CheckBox ID="CheckAll" CssClass="check_box" runat="server" Style="border: 0;" Text="全选/取消" />
....
请问如何使用FindControl取得它的名称



------解决方案--------------------
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string txt = ((CheckBox)(e.Row.FindControl("CheckAll"))).Text;
}
}
------解决方案--------------------
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string txt = ((CheckBox)(e.Row.FindControl("CheckAll"))).Text;
//在那列出現,下面是第六列出現 string txt2 = ((CheckBox)(e.Row.Cells[5].FindControl("CheckAll"))).Text;
}
}