Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 29th, 2009, 06:37 PM
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 using create user wizard

Hello Imar sir,
Well everything is going well till now. But the other thing that I am trying to look for is that Is there any way to determine that a user already exist or not, without full post back of the page?
That is as soon as we enter the user name it warns immediately if it exists already. I am using VB.NET . One solution that I think of is using web service, if I am right. So can you please tell the exact way or give some suggestion regarding this. Any help is appreciated.
Thank you..............
  #2 (permalink)  
Old October 29th, 2009, 08:03 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,048
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Hi there,

Take a look here: http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=494

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #3 (permalink)  
Old October 30th, 2009, 02:48 PM
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.
  #4 (permalink)  
Old October 30th, 2009, 03:03 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,048
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Hi there,

Page methods need to be marked static (Shared in VB) so you need to add the Shared keyword to the function header:

Code:
 
Public Shared Function UserNameExists(ByVal yourName As String) As Boolean
Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
sophia (October 30th, 2009)
  #5 (permalink)  
Old October 30th, 2009, 03:34 PM
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 Thank You Sir.......

Thank you sir, You are really amazing. Problem got solved at one shot.
I was missing shared keyword. You are really very nice
Thank you once again and for a quick reply...
  #6 (permalink)  
Old November 2nd, 2009, 02:57 AM
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 error pops up while signing up

Hello Sir,
I used web service for getting info. that a user already exists or not. It is working fine but while signing up it pops up an error window showing message
Code:
'userNameRequiredMessage' is null or not an object

But the signning up process is successful and creates a new account.
After while a debugging window opens showing message like
Code:
Breaking on JScript run time error-'userNameRequiredMessage' is null or not an object
And in the debugging editor it highlightes the code
Code:
userNameRequiredMessage.insertBefore(errorMessage)


So what should be done with it and how to get rid of it, althogh account is created successfully.
  #7 (permalink)  
Old November 3rd, 2009, 01:34 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,048
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Hi there,

Looks the final HTML of your CreateUserWizard doesn't match the code. Take a look at the final HTML in the browser and see what is assigned to userNameRequiredMessage is really pointing to a valid object in the HTML.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #8 (permalink)  
Old November 9th, 2009, 03:04 PM
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

Hello Sir,
First of all sorry I am here after a great time. And Thank you to answer me.
You suggested to look at html code in browser.
That is really massive.
Well The code that is generated is like
Code:
<script type="text/javascript"> 
//<![CDATA[
var PageMethods = function() {
PageMethods.initializeBase(this);
this._timeout = 0;
this._userContext = null;
this._succeeded = null;
this._failed = null;
}
PageMethods.prototype = {
_get_path:function() {
 var p = this.get_path();
 if (p) return p;
 else return PageMethods._staticInstance.get_path();},
UserNameExists:function(yourName,succeededCallback, failedCallback, userContext) {
/// <param name="yourName" type="String">System.String</param>
/// <param name="succeededCallback" type="Function" optional="true" mayBeNull="true"></param>
/// <param name="failedCallback" type="Function" optional="true" mayBeNull="true"></param>
/// <param name="userContext" optional="true" mayBeNull="true"></param>
return this._invoke(this._get_path(), 'UserNameExists',false,{yourName:yourName},succeededCallback,failedCallback,userContext); }}
PageMethods.registerClass('PageMethods',Sys.Net.WebServiceProxy);
PageMethods._staticInstance = new PageMethods();
PageMethods.set_path = function(value) {
PageMethods._staticInstance.set_path(value); }
PageMethods.get_path = function() { 
/// <value type="String" mayBeNull="true">The service url.</value>
return PageMethods._staticInstance.get_path();}
PageMethods.set_timeout = function(value) {
PageMethods._staticInstance.set_timeout(value); }
PageMethods.get_timeout = function() { 
/// <value type="Number">The service timeout.</value>
return PageMethods._staticInstance.get_timeout(); }
PageMethods.set_defaultUserContext = function(value) { 
PageMethods._staticInstance.set_defaultUserContext(value); }
PageMethods.get_defaultUserContext = function() { 
/// <value mayBeNull="true">The service default user context.</value>
return PageMethods._staticInstance.get_defaultUserContext(); }
PageMethods.set_defaultSucceededCallback = function(value) { 
 PageMethods._staticInstance.set_defaultSucceededCallback(value); }
PageMethods.get_defaultSucceededCallback = function() { 
/// <value type="Function" mayBeNull="true">The service default succeeded callback.</value>
return PageMethods._staticInstance.get_defaultSucceededCallback(); }
PageMethods.set_defaultFailedCallback = function(value) { 
PageMethods._staticInstance.set_defaultFailedCallback(value); }
PageMethods.get_defaultFailedCallback = function() { 
/// <value type="Function" mayBeNull="true">The service default failed callback.</value>
return PageMethods._staticInstance.get_defaultFailedCallback(); }
PageMethods.set_path("/sign_up.aspx");
PageMethods.UserNameExists= function(yourName,onSuccess,onFailed,userContext) {
/// <param name="yourName" type="String">System.String</param>
/// <param name="succeededCallback" type="Function" optional="true" mayBeNull="true"></param>
/// <param name="failedCallback" type="Function" optional="true" mayBeNull="true"></param>
/// <param name="userContext" optional="true" mayBeNull="true"></param>
PageMethods._staticInstance.UserNameExists(yourName,onSuccess,onFailed,userContext); }
//]]>
</script>
Can you now please tell me where is the problem.
Hope next time this problem be shoted out.
  #9 (permalink)  
Old November 9th, 2009, 03:09 PM
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 captcha

Sir, when I asked you about web service then the link you provided was of your site . There I noticed one thing that you used captcha. Is it another kind of web service or something else. Can you give just a little bit idea how to implement it.
Thank you........
  #10 (permalink)  
Old November 10th, 2009, 03:59 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,048
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

You need to look in the HTML (not JavaScript) for an element called userNameRequiredMessage

For the Captcha: check out the text above the comment block / Captcha on my site.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
user controls not sustaining on a wizard step!! kaliaparijat ASP.NET 2.0 Professional 1 June 6th, 2008 01:41 PM
modify create appointment wizard jeanhl BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 March 24th, 2008 04:37 AM
Create desktop icon using p&D wizard akhilesh_g Pro VB 6 0 January 7th, 2008 04:05 AM
[2.0] [create user wizard problem] manju.cdtech ASP.NET 2.0 Professional 0 May 9th, 2007 02:09 AM
insert new value through user wizard tool momo BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 3 April 19th, 2006 04:01 PM



All times are GMT -4. The time now is 08:47 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.