现在的位置: 首页 > 综合 > 正文

asp.net遍历页面所有的按钮(或控件)

2012年07月23日 ⁄ 综合 ⁄ 共 304字 ⁄ 字号 评论关闭
asp.net遍历页面所有的按钮(或控件)
 //遍历页面所有button,设置其可见属性为false
{
   if (btn.GetType().Name == "Button") 
    { 
     //((TextBox)txtobj).Text = ""; 
     //TextBox tb = new TextBox(); 
     //tb = (TextBox)this.FindControl(txtobj.ID); 
     //tb.Text = ""; 
     Button bt=new Button();
     bt=(Button)this.FindControl(btn.ID);
     bt.Visible=true;
    } 
}
 

抱歉!评论已关闭.