How do I get the value of a DropDownList control that was defined by customizing the CreateUserWizar

L

Learner

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 behind page on which

the CreatUserWizard control is existing.


This my Page_load event thats filling the drop down and this works fine

I am getting the data.


***************************************************************************­****************************

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
drplDealerShipID =
CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl­("_drplDealers"),

DropDownList)
Dim GetDealers As SqlDataReader = GetGroundingBL.GetDealers()
drplDealerShipID.DataSource = GetDealers
drplDealerShipID.DataValueField = "DealerShipID"
drplDealerShipID.DataTextField = "DealerShipName"
drplDealerShipID.DataBind()
GetDealers.Close()
End Sub
***************************************************************************­*****************************



But in the CreateUserWizard1_CreatedUser event I can't get the selected

value of the _drplDealers


***************************************************************************­****************************

Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object,
ByVal e As System.EventArgs) Handles CreateUserWizard1.CreatedUser
Dim drplDealerShipID As DropDownList = _


CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl­("_drplDealers"),

DropDownList)
Dim dealer As String
dealer = drplDealerShipID.SelectedValue.ToString
dealer = drplDealerShipID.SelectedValue.ToString
End Sub
***************************************************************************­*****************************



I am not sure the way I am trying to acces the dropdown control that
was filled before in the page_load event is right but it doesnt' throw
any error but I always get nothing although if I have selected a value.



Am I missing some thing here?


Thanks
-L
 
D

Dominick Baier [DevelopMentor]

Only fill the listbox on the first GET -

in Page_Load - enclose the databinding code in

If not IsPostback
....
 
L

Learner

Yes that was riduluous of me. :) I am not sure how I over looked it .
Yes thanks for the heads up it works now.
Thanks
-L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top