Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
Password Reminder
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 Search this Thread Display Modes
  #1 (permalink)  
Old January 15th, 2010, 01:40 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 Create user wizard-check existing user

Hello Sir,
well I was busy in my exams that's why I couldn't complete some tasks.
I had already discussed the topic but that was not complete and messed up with other posts just because of me. But now I will stick to only the relevant topic.
The problem was that while creating user account everything goes well except that it pops up the message like
Code:
usernameRequiredMessage is null or not an object
You replied earlier in this thread (Post No. 6 & 7). there you suggested to look for the html in browser.

The html is as follows (just posting required message)

Code:
<td>
<label for="ctl00_ContentPlaceHolder1_CreateUserWizard1_CreateUserStepContainer_UserName" id="ctl00_ContentPlaceHolder1_CreateUserWizard1_CreateUserStepContainer_UserNameLabel">
User Name:</label>
</td>
<td>
<input name="ctl00$ContentPlaceHolder1$CreateUserWizard1$CreateUserStepContainer$UserName" type="text" id="ctl00_ContentPlaceHolder1_CreateUserWizard1_CreateUserStepContainer_UserName" /> 
<span id="ctl00_ContentPlaceHolder1_CreateUserWizard1_CreateUserStepContainer_UserNameRequired" title="User Name is required." style="color:Red;visibility:hidden;">*</span>                                        </td>

<script type="text/javascript"> 
var userNameTextBox = $get('ctl00_ContentPlaceHolder1_CreateUserWizard1_CreateUserStepContainer_UserName');
var userNameRequiredMessage = $get('ctl00_ContentPlaceHolder1_CreateUserWizard1_CreateUserStepContainer_UserNameRequired');       var errorMessage = document.createElement('span');
errorMessage.style.visibility = 'hidden';
errorMessage.style.color = 'red'; 
errorMessage.innerText = 'Sorry; User Name Already Exist, Try Another Name';      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>
well I have looked at the html and seems quite right. But can you please spot out the error that I can not see.
Hope this time I'll get rid off this error.
Thank you sir...

Last edited by sophia; January 15th, 2010 at 01:44 PM..
  #2 (permalink)  
Old January 15th, 2010, 05:52 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Can you post the code for the page itself? And do you have a ScriptManager on the page?

Also, can you make this work with the download that comes with my article? If it does, check your source for any differences...

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 January 16th, 2010, 01:03 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 for having a look on problem.
The Page contains the master page and there is the Script Manager, which has EnablePageMethod set to True

The mark up for the page is

Code:
<%@ Page Language="VB" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="false" CodeFile="sign_up.aspx.vb" Inherits="sign_up" title="Sign Up" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
       <div id="content">
		<div class="post">
			<h2 class="title">Hi Guys, Just Fill In Form And Enjoy..............</h2>
			<div class="entry">
		        <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" 
                    
                    style="top: 392px; left: 340px; position: absolute; height: 294px; width: 328px" 
                    CreateUserButtonText="Sign Me Up" 
                    ContinueDestinationPageUrl="~/login.aspx" 
                    EditProfileText="Edit Your Record" EditProfileUrl="~/sign_up.aspx" 
                    EmailRegularExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
                    EmailRegularExpressionErrorMessage="Please Enter Email In Proper Format" Font-Italic="True" 
                    EmailLabelText="E-mail (Genuine):" 
                                        
                    InvalidPasswordErrorMessage="Password Length Should Be Minimum Of {0} Characters.">
                    <CreateUserButtonStyle ForeColor="#39561D" Font-Bold="True" 
                        Font-Italic="True" />
                    <WizardSteps>
                        <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
                        </asp:CreateUserWizardStep>
                        <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server" />
                    </WizardSteps>
                </asp:CreateUserWizard>
                
                <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 = 'Sorry; User Name Already Exist, Try Another Name'
      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>
             
		   </div>
		</div>
	</div>

</asp:Content>
And the code behind file is

Code:
Imports System.Web.Services
Imports System.Web.Security

Partial Class sign_up
    Inherits System.Web.UI.Page
    <WebMethod()> _
   Public Shared Function UserNameExists(ByVal yourName As String) As Boolean
        Return Membership.GetUser(yourName) IsNot Nothing
    End Function

End Class
I am astonished; I did try with the download that came with your article, it reports the same message there also.
Now what should I do. Please have a time to check the code as it is getting problem. How it can be removed.
Thank you sir...

Last edited by sophia; January 16th, 2010 at 01:32 PM..
  #4 (permalink)  
Old January 16th, 2010, 01:55 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

It runs fine for me, so it must be something in your site or configuration. Did youy try my sample site as is, in a new web site project?

How does the membership definition in web.config look?

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!
  #5 (permalink)  
Old January 17th, 2010, 07:09 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

Sir,
I have tried the code in a brand new web site project but same error persists.
And the Membership definition in the web.config file is as follows

Code:
<membership defaultProvider="AspNetSqlMembershipProvider">
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
</providers>
</membership>
I have done same as in the article.
Please throw some light on the topic.
Thank you...
  #6 (permalink)  
Old January 17th, 2010, 07:20 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
Please throw some light on the topic.
I can't, as I don't know what's wrong. Somehow, you don't have the correct client side elements in your page. You'll need to do some JavaScript and HTML debugging to see what's wrong.

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!
  #7 (permalink)  
Old January 17th, 2010, 07:24 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

Quote:
Somehow, you don't have the correct client side elements in your page. You'll need to do some JavaScript and HTML debugging to see what's wrong.
Can you please specify what are these client side elements? And thanks for giving hint of using debugging.
Thank you...
  #8 (permalink)  
Old January 17th, 2010, 07:29 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

The HTML elements that the JavaScript is looking for:

This:

var userNameTextBox = $get('ctl00_ContentPlaceHolder1_CreateUserWizard1_ CreateUserStepContainer_UserName');

gets a reference to an HTML element with an id of ctl00_ContentPlaceHolder1_CreateUserWizard1_Create UserStepContainer_UserName.

Since the error you get says some object is null, the right HTML may not be present.

Maybe you're not using ASP.NET 3.5? Maybe your AJAX framework in .NET 2 has not been set up correctly? (Please don't ask me how to that, as that is well, well, well beyond the scope of this book, my article and this forum. Check www.asp.net instead).

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!
  #9 (permalink)  
Old January 17th, 2010, 07:37 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

thanks for having look on the topic.
And I will try at the link you specified. Well I am using ASP.NET 3.5
Again thank you for that.
keep smiling
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
using create user wizard sophia BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 18 November 18th, 2009 11:57 AM
user controls not sustaining on a wizard step!! kaliaparijat ASP.NET 2.0 Professional 1 June 6th, 2008 12:41 PM
[2.0] [create user wizard problem] manju.cdtech ASP.NET 2.0 Professional 0 May 9th, 2007 01: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 03:01 PM
How to prompt user Internet Connection Wizard? joan VS.NET 2002/2003 0 September 30th, 2003 10:31 PM



All times are GMT -4. The time now is 03:18 AM.


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