473,386 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Force a postback with the CreateUserWizard control.

Hi!

I have a CreateUserWizard control with the usual suspects of
validators. As you're probably aware, each validator is associated
with one of CreateUserWizard's child controls.

When a user clicks on the Create User button on the first page,
validation occurs with javascript turning on a ValidationSummary, so
no postback occurs. For accessibility reasons, I would like the page
to be posted back so screen readers would be able to find the
validation errors.

Furthermore, if I could get a postback, I could also check the
ValidatorCollection for validators with their IsValid property set to
"false" in the page's PreRender event. I would like to cast the
validator back into it's original type (somehow?), find the value of
its AssociatedControlID, and then apply a class to its associated
control in the CreateUserWizard form.

Hopefully I could dynamically generate a class for each control that I
could style with CSS to draw attention to the fact that it contains
invalid data. I'd like to have a class applied to the rendered HTML
like:

<input type="text" class="alert" ...

Then with a trivial style in the CSS (e.g. input.alert { border:1px
solid red; } ) I could increase the usability of the form. It's a
mechanism I would like to extend to all forms in my site once I get it
working.

But my problem is when I use the CreateUserWizard, the page never gets
posted back if validation errors have occurred, so I can't trap for
the page's PreRender event AFTER the validation errors have happened.
Is there a way I can ensure the page will get posted back when someone
clicks the "Create User" button?

Also, if someone knows how I could cast an object that implements
IValidator back into its original type so I can access its
AssociatedControlID property without knowing the original type before
run-time, I'd love to hear about that too!

Let me know if I haven't been clear.

Cheers,

C.

Mar 19 '07 #1
2 3733
Sure. Do all your validation server side. Forget about client-side validators.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"ha******@hotmail.com" wrote:
Hi!

I have a CreateUserWizard control with the usual suspects of
validators. As you're probably aware, each validator is associated
with one of CreateUserWizard's child controls.

When a user clicks on the Create User button on the first page,
validation occurs with javascript turning on a ValidationSummary, so
no postback occurs. For accessibility reasons, I would like the page
to be posted back so screen readers would be able to find the
validation errors.

Furthermore, if I could get a postback, I could also check the
ValidatorCollection for validators with their IsValid property set to
"false" in the page's PreRender event. I would like to cast the
validator back into it's original type (somehow?), find the value of
its AssociatedControlID, and then apply a class to its associated
control in the CreateUserWizard form.

Hopefully I could dynamically generate a class for each control that I
could style with CSS to draw attention to the fact that it contains
invalid data. I'd like to have a class applied to the rendered HTML
like:

<input type="text" class="alert" ...

Then with a trivial style in the CSS (e.g. input.alert { border:1px
solid red; } ) I could increase the usability of the form. It's a
mechanism I would like to extend to all forms in my site once I get it
working.

But my problem is when I use the CreateUserWizard, the page never gets
posted back if validation errors have occurred, so I can't trap for
the page's PreRender event AFTER the validation errors have happened.
Is there a way I can ensure the page will get posted back when someone
clicks the "Create User" button?

Also, if someone knows how I could cast an object that implements
IValidator back into its original type so I can access its
AssociatedControlID property without knowing the original type before
run-time, I'd love to hear about that too!

Let me know if I haven't been clear.

Cheers,

C.

Mar 20 '07 #2
On Mon, 19 Mar 2007 17:02:00 -0700, Peter Bromberg [C# MVP] wrote:
Sure. Do all your validation server side. Forget about client-side validators.
Peter
I wouldn't quite go as far as saying that ... Personally i think it is
better to use client-side validators and then validate at the server
*anyway*.
--
Bits.Bytes
http://bytes.thinkersroom.com
Mar 20 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Byron Hopp [MCS] | last post by:
How do you force a postback, we have a button to save our users entry, but the button does not have a postback property (like the dropdownlistbox). Is there a way to force a postback? Byron...
6
by: Shawn | last post by:
Any ideas how I can have a button click on one open page force a postback on a different page.
3
by: Ben R. | last post by:
Seems like CreateUserWizard flat out ignores StartNavigationTemplate. Not sure why the designer bothers to offer for you to edit it, but even when you specifiy this, it doesn't seem to be used. Is...
2
by: Learner | last post by:
Hello, I have defined another textbox control in the CreateUserWizard control and this is how I am trying to get the value of it in the code behind page is below im myStep As...
0
by: Nehpets | last post by:
I'm trying to setup a web site that uses active directory for user authentication under asp.net 2.0. For testing, I have separately installed two virtual servers. The first is a domain...
0
by: Avi | last post by:
A CreateUserWizard contorl receives new user details, adds the user to the database, tries to send a confirmation mail message and stops with a "System.FormatException: The specified string is not...
0
by: asumal | last post by:
Hello I am new to ASP.NET. I am using CreateUserWizard control to register & create a user. I am using Membership API. I have a Cancel button on the CreateUserWizard step 2 alongwith Create User ...
0
by: asumal | last post by:
Hello I am new to ASP.NET. I am using CreateUserWizard control to register & create a user. I am using Membership API. I have a Cancel button on the second step of CreateUserWizard control...
4
by: gurufordy | last post by:
Hello. Trying to use the ASP.net user functionality but it keeps failing on me. I have created a login and registration page for my site. When you fill in the registration form it should send a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.