CreateUserWizard control: forcing it to use a programmatically provided username and e-mail

  • Thread starter Thread starter Ken Fine
  • Start date Start date
K

Ken Fine

I am using ASP.NET's CreateUserWizard control. I want to force the visitor
to use a username and e-mail address that I am providing in programming, and
I do not want the visitor to be able to edit the forms input.

I am aware that I can roll my own Create User form by using the membership
API, but I am lazy and want to use most of the CreateUserWizard control's
features.

I tried converting the form to a template and setting the UserName and Email
forms to Enabled="false" and populating their values programmatically. The
client-side validation behaviors prevent this from working: the non-enabled
items get red asterisks on input.

I imagine I could set the value for the names/e-mails in programming
regardless of the user's input, but I want to cue the visitor that they are
not allowed to change these values from what I am specifying.

Suggestions?

Thanks,
-KF
 
A bit more information: ASP.NET does have a "SubmitDisabledForm" boolean
property that can be attached to the form tag for the page. This does not
help with the client-side validation behavior I describe below.

-KF
 
OK, this ranks in the "duh" department, though the information I provided in
my last message regarding the SubmitDisabledForm property may be useful for
someone in the future.

To deal with the issue I describe below, convert the CreateUserWizard
control to a template, and simply go into the source and strip out the
RequiredFieldValidator controls from the controls that you are making
mandatory defaults.

-KF
 
Hi Ken,

Thanks for sharing your solution with us.

As for the Email field in CreateuserWizard, you can also consider set the
TextBox to readonly mode (via the "readonly" html attribute). e.g.

======
<asp:TextBox ID="Email" runat="server" onload="Email_Load"
readonly="true"></asp:TextBox>

==========

Thus, you can still programmtically assign value to the TextBox and the
value will be posted back when form is submit(validator will work correctly
with it).

Hope this also helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: "Ken Fine" <[email protected]>
Subject: SOLVED i think Re: CreateUserWizard control: forcing it to use a
programmatically provided username and e-mail
 
Back
Top