Results 1 to 4 of 4

Thread: AutoPostBack

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    AutoPostBack

    If I have an asp dropdown list and I select a value from that list, do I have to use the autopostpack attribute before I can pass the value of the dropdown to a session variable (for instance)???

    Cheers,


    Matt

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    Still learning asp.net myself but as from what i know, that would depend on when you want the value passed to the session variable.

    If you need the session variable changing as soon as the drop down box value is selected then yes you will need autopostback enabled and an onSelectedChanged event for your drop down box, such as:



    Code:
    Sub cbodropdown_SelectedIndexChanged(ByVal sender As system.Object, ByVal e As System.EventArgs)
    Session("whatever") = cboDropdown.selecteditem.value
    end sub
    
    'You will need these attributes set for your dropdown
    ' AutoPostBack="True" OnSelectedIndexChanged="cbodropdown_selectedindexchanged"
    if you only need the session variable updating after a page is finished with you won't need to use autopostback.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    Cheers

    I thought as much, I have 5 or 6 dropdowns on my page and need to retrieve the values from each after they have been selected so the page reloads each time I change them which doesn't really look that professional.

    I have limited knowledge of ASP.NET, so maybe there is a way.

    Thanks for your response.

    Matt.

  4. #4
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    adding smartnavigation=true to your page directive can sometimes help with the look of your page as it does things like remember which control had focus, don't know if this would help you.

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