当前位置: 代码迷 >> ASP.NET >> 请教gridview中pagertemplate中的checkbox怎么获得
  详细解决方案

请教gridview中pagertemplate中的checkbox怎么获得

热度:6673   发布时间:2013-02-25 00:00:00.0
请问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;
}
}
  相关解决方案