|
|
 |
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |
|

October 29th, 2009, 06:37 PM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 36
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
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..............
|

October 29th, 2009, 08:03 PM
|
 |
Wrox Author
Points: 33,554, Level: 80 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,228
Thanks: 7
Thanked 203 Times in 201 Posts
|
|
|

October 30th, 2009, 02:48 PM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 36
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
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.
|

October 30th, 2009, 03:03 PM
|
 |
Wrox Author
Points: 33,554, Level: 80 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,228
Thanks: 7
Thanked 203 Times in 201 Posts
|
|
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
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|

October 30th, 2009, 03:34 PM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 36
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
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...
|

November 2nd, 2009, 02:57 AM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 36
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
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.
|

November 3rd, 2009, 01:34 PM
|
 |
Wrox Author
Points: 33,554, Level: 80 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,228
Thanks: 7
Thanked 203 Times in 201 Posts
|
|
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
|

November 9th, 2009, 03:04 PM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 36
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
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.
|

November 9th, 2009, 03:09 PM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 36
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
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........
|

November 10th, 2009, 03:59 AM
|
 |
Wrox Author
Points: 33,554, Level: 80 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,228
Thanks: 7
Thanked 203 Times in 201 Posts
|
|
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
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |