ASP.NET中轮循页面控件,怎么得到控件类型?我得到的是System.Web.UI.LiteralControl怎么不是System.Web.UI.WebControls.Button?
ASP.NET中轮循页面控件,怎么得到控件类型?我得到的是System.Web.UI.LiteralControl怎么不是System.Web.UI.WebControls.Button?
[解决办法]
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
checkbutton();
}
protected void checkbutton()
{
for (int i = 0; i < form1.Controls.Count; i++)
{
Button bt = form1.Controls[i] as Button;
if (bt != null)
{
bt.Text = "找到了";
}
}
}