Click here to Skip to main content
15,886,036 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
when a user sign up he entered a username..the validation will check the username is available or not ..how to set this method in asp.net and c#?...or jquery..am using asp.net,c#,Jquery..
Posted

Post your user name to server when your text field changes focus and in server side query the database for checking the existence of user name if user name don't exist just send "OK" in json format else send any thing except "OK"

JQuery code is provided and i think you are able to write server side code

JavaScript
$('#YourUserNameField').blur(function () {
    var value = $('#YourUserNameField').val();
    $.ajax({
           url: '/Web_Method_To_Check_UserName/?uName='+value,
           type: 'post',
           success: function (data) {
           if (data.Result == "OK") {
               _canSubmit = true;
               $('#your_user_name_error_label').hide();
           }
           else {
               _canSubmit = false;
               $('#your_user_name_error_label').show();
           }
        },
        error: function () {
           alert("Error Occured");
        }
    });
});
 
Share this answer
 
 
Share this answer
 
Comments
[no name] 26-Feb-14 4:38am    
how to set username not available method without using script manager
Tom Marvolo Riddle 26-Feb-14 4:47am    
then remove updatepanel
[no name] 26-Feb-14 4:49am    
k..thanks..
Tom Marvolo Riddle 26-Feb-14 4:50am    
try it and let me know.
[no name] 26-Feb-14 4:51am    
k.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900