Let us start by building this application..
Step1: open vs>File>New Website>give the name and click ok..
Step2: Right click on your website and click on webservices and give its name..
Step3: In the webservices uncomment this line
[System.Web.Script.Services.ScriptService]..
we need to uncomment this line in order to use ajax application on your page..
Step4:
Now give the webservice method name as usernameexist.. Write these lines of code

In this we are passing username.. As you might guess from the code that we are returning MembershipUser..
Step5:
Now open the Default.aspx page and add the ScriptManager on to the page and give the service reference to your web service.. write these lines of code..

In my case webservice name is WebService3.asmx and it will be differnt in your code..
Step6:
Now add the asp.net TextBox and the Html button on to your page.. And one more thing place the paragraph in order to store our message..

And double click on to the button..
Step7:
After double clicking We need to call the Webservice.. We need to write these lines of code

In this case first we are giving reference to Textbox by using a variable called text.. Then we need to call the webservice by adding the [classname].[webmethodname] and need to pass the parameters.. We are using onsuccess when that webservice got successed, onfailed for failure and the usercontext as "user exist".. We gave the reference to the paragraphid user by using a variable called span.. Now its a time to test your application..
I hope you like this Article..
No comments:
Post a Comment