我作一个注册。
先作了用户名,密码框(用TextBox)作的,然后是DropDownList联动省市,但运行的时候,添入了密码后,再选择省市时,密码框里就被清空??我不想用无刷新的DropDownList联动、JS来作,也不想先选择省市,再添密码。
请问能不能实现呢?

解决方案 »

  1.   

    用UpdatePanel啊 ,vs2008里有自带的
      

  2.   

    ajax实现 vs2008自带 vs2005装个ajax组件就可以了 但部署的环境也需要装的
      

  3.   

    vs2005一样的你下System.Web.Extensions.dll 到这个引用到工具器里一样可以拖进去
      

  4.   

    <script>
            function SavePassword(srcControl) {
                document.getElementById("Hidden1").value = srcControl.value;
            }
            window.onload = function() {
                document.getElementById("<%=TextBox1.ClientID %>").value = document.getElementById("Hidden1").value;
            }
        </script>.html
    <div>
            <asp:TextBox ID="TextBox1" runat="server" TextMode=Password></asp:TextBox>
            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack=true 
                onselectedindexchanged="DropDownList1_SelectedIndexChanged" 
                Width="130px">
            <asp:ListItem Selected=True Text=1 Value=1></asp:ListItem>
             <asp:ListItem  Text=3 Value=3></asp:ListItem>
            </asp:DropDownList>
            <input type=hidden id="Hidden1" runat=server />
        </div>.cs
     protected void Page_Load(object sender, EventArgs e)
            {
                this.TextBox1.Attributes.Add("onblur","javascript:SavePassword(this)");
            }
      

  5.   

    同意楼上的,提交到服务器当中去密码肯定丢失,
    建议用隐藏直,
    当填完密码框,就触发一个脚本保存值

    当DROPDOWNLIST改变触发一个脚本赋值
      

  6.   

    支持用UpdatePanel,这样刷新的问题,项目中不应该只有一次出现
    <asp:UpdatePanel>
        <asp:TextBox/> //用户名
        <asp:TextBox/> //密码
        <asp:UpdatePanel>
            <asp:DropDownList/> //省
            <asp:DropDownList/> //市
        </asp:UpdatePanel>
    </asp:UpdatePanel>
      

  7.   

    用JS写 活结用ajax无刷新效果
      

  8.   

     this.txtpwd.Attributes.Add("value", txtpwd.Text);
    this.txtpwd2.Attributes.Add("value", txtpwd2.Text);
    在page_load里面加入上面的代码就可以了。不要在IsPostBack里面写。