DropDownList Control problem

Discussion in 'ASP .Net' started by Mike, Aug 8, 2007.

  1. Mike

    Mike Guest

    Hi
    I am using predefined membership and roles managemant approach
    characteristic for framework 2.0

    Basic idea is that we select some value from DropDownList which
    represents a role and we get all users for selected role.
    This works and that is not a problem.

    Problem is in DropDownList control...

    I am using select value as follow:
    string roles = DropDownList_Roles.SelectedValue;

    Recieived items
    ---------------------------------------------------------------------------
    DropDownList_Roles.DataSource = Roles.GetAllRoles();
    DropDownList_Roles.DataBind();

    For e.g. if I get following vales:
    ABC
    AAA
    CCC
    RRR
    FFF

    What is wrong?
    -----------------------------
    Whatever I select, I always getting first value, in this case value
    ABC.

    Thanks for help.

    Mike
    Mike, Aug 8, 2007
    #1
    1. Advertising

  2. It looks like you are populating your dropdown in Load event, but do not
    check IsPostBack property. Ensure that your dropdown is only populated when
    this property is false

    "Mike" wrote:

    > Hi
    > I am using predefined membership and roles managemant approach
    > characteristic for framework 2.0
    >
    > Basic idea is that we select some value from DropDownList which
    > represents a role and we get all users for selected role.
    > This works and that is not a problem.
    >
    > Problem is in DropDownList control...
    >
    > I am using select value as follow:
    > string roles = DropDownList_Roles.SelectedValue;
    >
    > Recieived items
    > ---------------------------------------------------------------------------
    > DropDownList_Roles.DataSource = Roles.GetAllRoles();
    > DropDownList_Roles.DataBind();
    >
    > For e.g. if I get following vales:
    > ABC
    > AAA
    > CCC
    > RRR
    > FFF
    >
    > What is wrong?
    > -----------------------------
    > Whatever I select, I always getting first value, in this case value
    > ABC.
    >
    > Thanks for help.
    >
    > Mike
    >
    =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=, Aug 8, 2007
    #2
    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. mr2_93
    Replies:
    1
    Views:
    3,597
    mr2_93
    Oct 2, 2005
  2. tshad
    Replies:
    8
    Views:
    2,228
    tshad
    Oct 19, 2005
  3. =?Utf-8?B?SnVhbmpv?=

    GridView: Filtr DropDownList from another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,863
    =?Utf-8?B?SnVhbmpv?=
    Dec 23, 2005
  4. =?Utf-8?B?SnVhbmpv?=

    GridView: Filter DropDownList for another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 29, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,296
    =?Utf-8?B?SnVhbmpv?=
    Dec 29, 2005
  5. keithb
    Replies:
    1
    Views:
    11,970
    shauns1
    Nov 1, 2006
Loading...

Share This Page