Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Set the DropDownList AutoPostBack property for some items

Set the DropDownList AutoPostBack property for some items

Scheduled Pinned Locked Moved ASP.NET
questiontutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Luay Essa
    wrote on last edited by
    #1

    How can i set the AutoPostBack property for some items in the dropdownlist ? Example: When i select some items in the dropdownlist, i want the page to postback, while other items should not.

    S U 2 Replies Last reply
    0
    • L Luay Essa

      How can i set the AutoPostBack property for some items in the dropdownlist ? Example: When i select some items in the dropdownlist, i want the page to postback, while other items should not.

      S Offline
      S Offline
      SABhatti
      wrote on last edited by
      #2

      set the AutoPostBack property to FALSE for the dropdownlist (ddl). Create a javascript fucntion e.g. function ddlOnchange(selectedValue) { if(selectedValue == 'yourrequired value') document.formname.submit(); else return false; } and add onchange attribute to the ddl in code behind file e.g. ddl.Attributes.Add("onchange", "javascript:ddlOnchange(this.value);");

      -----

      1 Reply Last reply
      0
      • L Luay Essa

        How can i set the AutoPostBack property for some items in the dropdownlist ? Example: When i select some items in the dropdownlist, i want the page to postback, while other items should not.

        U Offline
        U Offline
        UsmanMunier
        wrote on last edited by
        #3

        i dont think you can achieve this with ASP.NET becasue postback is a property of Control not the items associated with that control. for this you have do some extra work to make a custom drop down but still not sure its possible or not.

        Usman Munier Xavor Corporation Pakistan

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups