473,386 Members | 1,644 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.

DropDownList, CreateUserWizard - postback issues

Hi Everyone,

I have a CreateUserWizard my public sign up page of my website. I
have edited the wizard to include collection of other personal
information. I have a DropDownList for the selection of the
Graduation year. Find the code below to Insert all the additional
information to another database when a new ASP user is created. The
DropDownList gets cleared of all data during execution of this code.
Your thoughts on the solution expected.

DropDownList Properties:

* EnableViewState: True
* AppendDataBoundItems: False
* AutoPostBack: False
* Causes Validation: False

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

If Page.IsPostBack = False Then

Dim YearList As DropDownList =
CreateUserWizardStep1.ContentTemplateContainer.Fin dControl("Year")
Dim nStartYear As Integer = 1980
Dim nCurrentYear As Integer = CType(Date.Now.Year,
Integer)

For index As Integer = nStartYear To nCurrentYear
YearList.Items.Add(index)
Next

End If
End Sub
Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object,
ByVal e As System.EventArgs) Handles CreateUserWizard1.CreatedUser

Dim UserNameEntered As TextBox =
CreateUserWizardStep1.ContentTemplateContainer.Fin dControl("Username")
Dim DateOfBirth As TextBox =
CreateUserWizardStep1.ContentTemplateContainer.Fin dControl("DateOfBirth")
Dim YearList As DropDownList =
CreateUserWizardStep1.ContentTemplateContainer.Fin dControl("Year")

Dim User1 As MembershipUser =
Membership.GetUser(UserNameEntered.Text)
Dim UserGUID As Object = User1.ProviderUserKey
Dim DOB As Date = Date.ParseExact(DateOfBirth.Text, "dd/MM/
yyyy", Nothing)

'The Problem is seen in the line below, the DropDownList (YearList)
gets cleared of all
'Items which makes me unable to find the Selected Value of the Year
of Graduation

Dim GraduatedYear As Date =
Date.ParseExact(YearList.SelectedValue, "yyyy", Nothing)

Dim DataSource As SqlDataSource =
CreateUserWizardStep1.ContentTemplateContainer.Fin dControl("InsertUserInfo")
DataSource.InsertParameters.Add("ASPUserId",
UserGUID.ToString())
DataSource.InsertParameters.Add("GraduationYear",
GraduationYear)
DataSource.Insert()

Roles.AddUserToRole(UserNameEntered.Text, "MemberUser")

End Sub

Sep 10 '07 #1
0 2137

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

Similar topics

4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
1
by: Phil | last post by:
I would like to make the CreateUserWizard's security question box display as a databound (xml file) dropdownlist. I can make the dropdownlist display by using a contenettemplate, but I can't get...
0
by: Tand35006 | last post by:
Hi, I hope some one can help with this. I have a basic webform with 2 DropDownLists and a single DataGrid. What I am trying to do is populate the first DDList from a dataset on Form_Load. I then...
0
by: Learner | last post by:
Hello, We have a need to customize the CreateUserWizard and we put a DropDownList control in there. And we are filling that DropDownControl ( _drplDealers) in the page_load event of the code...
2
by: hardieca | last post by:
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...
3
by: Lohboy | last post by:
Using ASP.NET and IE7. (Sorry if I am posting in the wrong forum but my problem seemed to be more related to the JavaScript side than the ASP.NET side.) I have two DropDownList controls the...
18
by: Redhairs | last post by:
Is it possible to get DropDownList.SelectedValue in Page_PreInit() event during the postback?
3
by: Ken Fine | last post by:
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...
1
by: Brett | last post by:
I have a DropDownList in an ASP.NET web form that is populated with items from a lookup table by binding that DropDownList to a SqlDataSource. However, the items in the lookup table can change over...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.