利用JavaScript 產生的html Control ,在Server 端要如何抓到它的Value

利用JavaScript 產生的web Server Control ,在Server 端要如何抓到它的Value

[前言]

這是今天早上死黨問的問題,後來還是他自己找到的答案,寫出來給大家參考一下...

[說明]

   1:  <script language='javascript' type="text/javascript">
   2:       var allowed_attachments = 8 - 1;
   3:       var count_attachments = 0 + 1;
   4:      
   5:       function addfile()
   6:       {
   7:            if (allowed_attachments <= 0)
   8:            {
   9:                return false;
  10:            }
  11:            else
  12:            {            
  13:                 count_attachments = count_attachments + 1 ;
  14:                 var attid = "FUP"+count_attachments;
  15:              
  16:                 document.getElementById("ctl00_ContentPlaceHolder1_HF1").value=count_attachments;
  17:                 var str = "";
  18:                 str = str+ "<input name='TexNum"+count_attachments+"' type='text' style='height:25px;width:48px' maxlength='20' id='ctl00_ContentPlaceHolder1_TexNum"+count_attachments+"'>";
  19:                 allowed_attachments = allowed_attachments - 1;
  20:              
  21:                 return false;
  22:             }    
  23:      }           
  24:   </script>

他是刻意利用JavaScript去產生html control(他說不想postBack所以才這樣玩地...)
這邊的程式主要是給大家簡單參考而已(反正就是用JS去產生html control而已),重點在下面這一個程式碼...

   1:  string strId = "TexCap2";  
   2:  string strValue = Request.Form[strId].ToString();
   3:  Response.Write(strValue+"-----");