• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 如何用foreach遍歷頁面上所有的TextBox

    發表于:2007-07-14來源:作者:點擊數: 標簽:
    1.整個頁面的判斷 foreach(Control ctl in this.Controls[1].Controls) { if(ctl.GetType().Name=="TextBox") { TextBox tb =new TextBox(); tb=(TextBox)this.FindControl(ctl.ID); if(tb.Text==string.Empty) { Response.Write("scriptalert('" + ctl.ID +
    1.整個頁面的判斷

    foreach(Control ctl in this.Controls[1].Controls)
    {
     if(ctl.GetType().Name=="TextBox")
     {
      TextBox tb =new TextBox();
      tb=(TextBox)this.FindControl(ctl.ID);
      
      if(tb.Text==string.Empty)
      {
       Response.Write("<script>alert('" + ctl.ID + "的值為空。');</script>");
       break;
      }
     }
    }

    2.指定formID里TextBox 判斷

    先找出你的Form的ID
    protected HtmlForm yourformID;

    foreach (object obj in yourformID.Controls)
    {
       if (obj is TextBox)
       {
          TextBox tb = (TextBox)obj;
          if (tb.Text = string.Empty)
          {
              Response.Write("<script>alert('" + tb.ID + "的值為空。');</script>;")
          }
       }
    }


    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>