我做了一个注册页面,其中有一个密码框txtuserpass
string userpass=txtuserpass.Text;
在程序运行时userpass值为空这是什么原因?

解决方案 »

  1.   

    txtuserpass.Attributes.Add("value","');
      

  2.   

    看是不是在点击确定的是后回发了
    AutoPostBack="false";
      

  3.   

    可能你的页面中有多个form
    你查一下,我以前也遇到过这种情况
      

  4.   

    页面中多个form或者按钮和文本框在不同的updatepanel中
      

  5.   

    那肯定是txtuserpass.Text没取到值了
      

  6.   

    如果是html控件 直接Request.Form['name']