View Single Post
  #3 (permalink)  
Old October 30th, 2009, 01:48 PM
sophia sophia is offline
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

First of all thank you sir for such a great post.
But I am still having some problem. As I am using VB.NET so accordingly I changed the web service in vb.net and used in code behind file
The web service that I used looks like
Code:
Partial Class sign_up
    Inherits System.Web.UI.Page
   
 <WebMethod()> _
   Public Function UserNameExists(ByVal yourName As String) As Boolean
        Return Membership.GetUser(yourName) IsNot Nothing
    End Function

   Emailing function goes here.............
End Class
And used the code in sign_up.aspx file as mentioned in post.

Code:
create user wizard here....................
  
     <script type="text/javascript">
    
      var userNameTextBox = $get('<%= CreateUserWizard1.ClientID %>_CreateUserStepContainer_UserName')
      var userNameRequiredMessage = $get('<%= CreateUserWizard1.ClientID %>_CreateUserStepContainer_UserNameRequired')

      var errorMessage = document.createElement('span')
      errorMessage.style.visibility = 'hidden'
      errorMessage.style.color = 'red'
      errorMessage.innerText = 'User name already taken'
      userNameRequiredMessage.insertBefore(errorMessage)

      function UserNameExists()
      {
        var userName = userNameTextBox.value
        PageMethods.UserNameExists(userName, UserNameExistsCallback)
      }

      function UserNameExistsCallback(result)
      {
        errorMessage.style.visibility = result ? 'visible' : 'hidden'
      }

      $addHandler(userNameTextBox, 'blur', UserNameExists)
      
    </script>
I have used script manager in master page and necessary namespace in code behind file sign_up.aspx.vb
But on running the code it reports an error as PageMethod is not declared. Is there any thing wrong with webservice that I have changed to vb.net or in calling it?
How it can be fixed.....
Thank you once again for such post.