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

Discussion in 'ASP .Net Security' started by Learner, Apr 25, 2006.

  1. Learner

    Learner Guest

    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
    Learner, Apr 25, 2006
    #1
    1. Advertising

  2. Only fill the listbox on the first GET -

    in Page_Load - enclose the databinding code in

    If not IsPostback
    ....

    ---------------------------------------
    Dominick Baier - DevelopMentor
    http://www.leastprivilege.com

    > 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.FindCo
    > ntrol
    > ­(" 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.FindCo
    > ntrol ­(" 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
    >
    Dominick Baier [DevelopMentor], Apr 25, 2006
    #2
    1. Advertising

  3. Learner

    Learner Guest

    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
    Learner, Apr 25, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vsssandeep boggavarapu via .NET 247

    Customizing the Data Grid Control

    vsssandeep boggavarapu via .NET 247, Jun 7, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    585
    Alvin Bruney [MVP - ASP.NET]
    Jun 11, 2005
  2. aftab
    Replies:
    0
    Views:
    784
    aftab
    May 15, 2004
  3. ad
    Replies:
    2
    Views:
    2,944
    ghinwa
    Aug 13, 2009
  4. Diego

    CreateUserWizar

    Diego, May 10, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    467
    Diego
    May 10, 2005
  5. Oodini
    Replies:
    1
    Views:
    1,766
    Keith Thompson
    Sep 27, 2005
Loading...

Share This Page