textbox控件,如何做输入验证

解决方案 »

  1.   

    textbox失去焦点时ajax发送到服务器,查询数据库,再把查询结果返回,用js判断显示相关信息。
      

  2.   

    textbox后放一“验证用户”button,输入完用户名后点击验证。
      

  3.   


    要么JS 或JQ 简单点:
    直接拖个AJAX 异步刷新  后台直接判断 
    <asp:ScriptManager ID="ScriptManager1" runat="server">
     </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
    <table>
    //放个Label显示信息 ,后台直接数据库判断,存在则显示 不存在则隐藏。
    </table>   </ContentTemplate>
            </asp:UpdatePanel>
      

  4.   

    建议用jquery ajax,方便,简单。 
      

  5.   

    ajax + js参考这个: http://www.w3school.com.cn/ajax/ajax_asp_php.asp
      

  6.   

    textbox失去焦点时,查询数据库中有没有输入的用户名。
      

  7.   


    string myConnectionString = "Initial Catalog=dengru;Data Source=localhost;Integrated Security=SSPI;";
                myConnection = new SqlConnection(myConnectionString);
                cmd = new SqlCommand();
                cmd.Connection = myConnection;
                myConnection.Open();
                string sql;
                sql = "select user from dr where ID='" + textBox1.Text.Trim() + "' and PassWord= '" + textBox2.Text.Trim() + "'";
                cmd.CommandText = sql;
                if (cmd.ExecuteScalar() != null)
                {
                   //存在
                }
      

  8.   

    微软对自己那个Membership已经提供了Web Service供js客户端调用了。还包括Role, Profile等。
      

  9.   

    还是建议用 JQ 的 ajax  现在的  ajax 用处很多 
      

  10.   

    XMLHttpRequest实现无刷新验证用户名 http://blog.csdn.net/sandy945/article/details/4169870
      

  11.   

    把用户名传进数据库进行查找对象,如为NULL,则没有,否则,有。在数据访问层查找,在逻辑层判断