Results 1 to 5 of 5

Thread: How to take action when selecting from dropdownlist

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    How to take action when selecting from dropdownlist

    This might be a dumb question, but I am populating a dropdownlist with database values. And whenever someone is making a selection from that list I want the repeater on the page to be filled with something based on the value of the selected item in the dropdown. I DON'T want a button to be pressed when to refresh the repeater, I want this to be done as soon as the user selects something. I tried the selectedinsexchanged event and nothing happens...

    kind regards
    Henrik

  2. #2
    Junior Member
    Join Date
    Feb 2003
    Posts
    16
    You need to set "autopostback=true" so that when the selected index is changed it causes a postback to the server.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    Ok I have a BindGrid() method that to the following:

    fill the dropdownlist and the repeater with data
    that method is called in page_load with the condition
    if(!IsPostback)
    {
    BindData();
    }

    the BindGrid makes select from the db and set databind for both the webcontrols.

    Should I also use binddata in the event

    private DropDownList_SelectedIndexChanged()
    {
    BindData();
    }

    Or how should I do it??? Note that Im using developer studio, so many changes can be done with the GUI

    kind regards
    Henrik

  4. #4
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Also, set the autopostback property on the dropdownlist to true;
    Dont gain the world and lose your soul

  5. #5
    Junior Member
    Join Date
    Feb 2003
    Posts
    16
    The way you are doing it looks just fine. That's how I would do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width