当前位置: 代码迷 >> ASP.NET >> Request.Form有关问题
  详细解决方案

Request.Form有关问题

热度:4762   发布时间:2013-02-26 00:00:00.0
Request.Form问题
我在aspx文件中通过js在一个div的innerHTML中添加了一个 <input   type= "text "   id= "txtName "> ,在对应的cs文件中怎么访问txtName,通过Request.Form[ "txtName "]访问不到

------解决方案--------------------------------------------------------
<input type= "text " id= "txtName " name= "txtName "> 要name
------解决方案--------------------------------------------------------
Request.Form 取 name属性
------解决方案--------------------------------------------------------
管它三七二十一,ID,NAME 一起多加上肯定没错,都用同一个名字
呵呵
------解决方案--------------------------------------------------------
改成这样: <input runat= "server " type= "text " id= "txtName "> ,你就可以使用this.txtName.Text访问了。
------解决方案--------------------------------------------------------
<input type= "text " id= "txtName " name= "txtName ">
  相关解决方案