p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 (http://p2p.wrox.com/forumdisplay.php?f=252)
-   -   using create user wizard (http://p2p.wrox.com/showthread.php?t=76818)

sophia October 29th, 2009 05:37 PM

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..............

Imar October 29th, 2009 07:03 PM

Hi there,

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

Imar

sophia October 30th, 2009 01:48 PM

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.

Imar October 30th, 2009 02:03 PM

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

sophia October 30th, 2009 02:34 PM

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...

sophia November 2nd, 2009 02:57 AM

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.

Imar November 3rd, 2009 01:34 PM

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

sophia November 9th, 2009 03:04 PM

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.

sophia November 9th, 2009 03:09 PM

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........

Imar November 10th, 2009 03:59 AM

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

sophia November 10th, 2009 08:20 AM

Thank you sir for such valuable post

sophia November 10th, 2009 11:00 AM

thank you for valuable post

sophia November 16th, 2009 02:37 PM

using ad rotator.
 
Well sir I know that this is not the right thread to be used but as it is not so much used that's why I am putting it here. Before asking you I did ask the same in general threads of Basics of ASP.NET 3.5 but did not get answer at all. Also made searches on the topic in hand but not so fruitful.
My que. was
I want to know about how to show ads without refreshment of page. I have used the adrotator and it is working fine.For this I use xml file. But it changes the images after refreshment of page. But is there any way to change images without refreshing page however still using adrotator
So sir can you please give again some useful hint to resolve.
Thank you..................

Imar November 17th, 2009 05:22 AM

Quote:

Also made searches on the topic in hand but not so fruitful.
Really? You must be using a different Google than I am. Your exact terms "show ads without refreshment of page" result in this:

http://www.google.nl/search?hl=en&so...f+page&aq=f&oq=

The 7th result then eventually takes you here:

http://www.dotnetcurry.com/ShowArtic...ookieSupport=1

Which shows you exactly what you need.....

Imar

sophia November 17th, 2009 02:41 PM

Thank you, Thank you, Thank you sir for your warm reply.
I also had an idea about using timer and update panel with adrotator, but if we use timer then don't you think that it will create a problem while handling with pages which require some input from user or selecting from drop down lists viz. pages like feedback or anything else if I put the feedback.ascx type control in another update panel as timer will update this panel also and user wouldn't be able to write/selecting anything. (Requirement for putting controls like feedback.ascx in update panel is just to show the progress to user of message being sent using update progress control)

Thank you sir..........
Keep smiling.

Imar November 17th, 2009 03:34 PM

Are you aware of an invention called punctuation?

Anyway, yes, you may end up with focus issues when the page refreshes. You could try an iframe, or tr it with custom JavaScript code and, for example, Page Methods or web services.

Imar

sophia November 18th, 2009 11:35 AM

Quote:

Are you aware of an invention called punctuation?
what does it mean?
Well thank you sir, I will go for JavaScript code.

Thank you for suggestion.
Keep smiling...

Imar November 18th, 2009 11:46 AM

It refers to the little glyphs like dots and commas people typically put between the words they write to make sentences easier to read and understand. You just go on and on without a full stop, making it hard to understand your requests.

Imar

sophia November 18th, 2009 11:57 AM

Oh I see,
so sorry sir, yeah in second last post I just kept typing. Next time I'll take care of it.
Hope my posts do not bother you, if it is a case then please let me know and give me some feedback (+ve or -ve).
Thank you once again


All times are GMT -4. The time now is 11:34 PM.

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