ASP.NET(C#)中遍歷所有控件
來源:懂視網(wǎng)
責(zé)編:小采
時(shí)間:2020-11-27 22:44:03
ASP.NET(C#)中遍歷所有控件
ASP.NET(C#)中遍歷所有控件: 代碼如下:for (int i = 0; i < this.Controls.Count; i++) { foreach (System.Web.UI.Control control in this.Controls[i].Controls) { if (control is TextBox) (control as TextBox).Text
導(dǎo)讀ASP.NET(C#)中遍歷所有控件: 代碼如下:for (int i = 0; i < this.Controls.Count; i++) { foreach (System.Web.UI.Control control in this.Controls[i].Controls) { if (control is TextBox) (control as TextBox).Text
代碼如下:
for (int i = 0; i < this.Controls.Count; i++)
{
foreach (System.Web.UI.Control control in this.Controls[i].Controls)
{
if (control is TextBox)
(control as TextBox).Text = "";
}
}
foreach (Control cl in this.Page.FindControl("Form1").Controls)
{
if (cl.GetType().ToString() == "System.Web.UI.WebControls.TextBox")
{
((TextBox)cl).Text = "";
}
}
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
ASP.NET(C#)中遍歷所有控件
ASP.NET(C#)中遍歷所有控件: 代碼如下:for (int i = 0; i < this.Controls.Count; i++) { foreach (System.Web.UI.Control control in this.Controls[i].Controls) { if (control is TextBox) (control as TextBox).Text