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. dropdownlist SelectedIndexChanged not firing

dropdownlist SelectedIndexChanged not firing

Scheduled Pinned Locked Moved ASP.NET
helpsysadminquestion
4 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.
  • M Offline
    M Offline
    moazzamahmed
    wrote on last edited by
    #1

    hi all, anyone see an error in this? my selectindexchanged wont fire. Ive tried a lot of things, remving panel, keeping panel, taking other controls off the page etc. etc. The data loads perfectly. The control has "autopostback" set to false. If I do true, it tries to go to the server and I dont need it to go to the server, just ... fire the event. any help would be greatly appreciated, thanks in advance. aspx ----

    codebehind: ----------- public partial class index1 : MC.Web.webPagebase { protected void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here DropDownList1.DataSource = mc_type.GetAllTypes(); DropDownList1.DataTextField = "TypeText"; DropDownList1.DataValueField = "TypeAbbrev"; //DropDownList1.SelectedIndexChanged += new EventHandler (DropDownList1_SelectedIndexChanged); I tried with this and with defining this in aspx file DropDownList1.DataBind(); } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = "aah"; }

    P 1 Reply Last reply
    0
    • M moazzamahmed

      hi all, anyone see an error in this? my selectindexchanged wont fire. Ive tried a lot of things, remving panel, keeping panel, taking other controls off the page etc. etc. The data loads perfectly. The control has "autopostback" set to false. If I do true, it tries to go to the server and I dont need it to go to the server, just ... fire the event. any help would be greatly appreciated, thanks in advance. aspx ----

      codebehind: ----------- public partial class index1 : MC.Web.webPagebase { protected void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here DropDownList1.DataSource = mc_type.GetAllTypes(); DropDownList1.DataTextField = "TypeText"; DropDownList1.DataValueField = "TypeAbbrev"; //DropDownList1.SelectedIndexChanged += new EventHandler (DropDownList1_SelectedIndexChanged); I tried with this and with defining this in aspx file DropDownList1.DataBind(); } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = "aah"; }

      P Offline
      P Offline
      Prasad Babu A
      wrote on last edited by
      #2

      Hi, If u want SelectIndexChanged method to run, u need to set AutoPostBack property of DropDownList to true. Then only it will fires. Try this, it will helps u... aspx ----

      codebehind: ----------- public partial class index1 : MC.Web.webPagebase { protected void Page_Load(object sender, System.EventArgs e) { if(!IsPostBack) { DropDownList1.DataSource = mc_type.GetAllTypes(); DropDownList1.DataTextField = "TypeText"; DropDownList1.DataValueField = "TypeAbbrev"; DropDownList1.DataBind(); }//end-if } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = DropDownList1.SelectedItem.ToString(); } Bye Pessi.

      R M 2 Replies Last reply
      0
      • P Prasad Babu A

        Hi, If u want SelectIndexChanged method to run, u need to set AutoPostBack property of DropDownList to true. Then only it will fires. Try this, it will helps u... aspx ----

        codebehind: ----------- public partial class index1 : MC.Web.webPagebase { protected void Page_Load(object sender, System.EventArgs e) { if(!IsPostBack) { DropDownList1.DataSource = mc_type.GetAllTypes(); DropDownList1.DataTextField = "TypeText"; DropDownList1.DataValueField = "TypeAbbrev"; DropDownList1.DataBind(); }//end-if } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = DropDownList1.SelectedItem.ToString(); } Bye Pessi.

        R Offline
        R Offline
        robmays
        wrote on last edited by
        #3

        if you have copied this control it may have the wrong event on the aspx page check the control on aspx page

        1 Reply Last reply
        0
        • P Prasad Babu A

          Hi, If u want SelectIndexChanged method to run, u need to set AutoPostBack property of DropDownList to true. Then only it will fires. Try this, it will helps u... aspx ----

          codebehind: ----------- public partial class index1 : MC.Web.webPagebase { protected void Page_Load(object sender, System.EventArgs e) { if(!IsPostBack) { DropDownList1.DataSource = mc_type.GetAllTypes(); DropDownList1.DataTextField = "TypeText"; DropDownList1.DataValueField = "TypeAbbrev"; DropDownList1.DataBind(); }//end-if } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = DropDownList1.SelectedItem.ToString(); } Bye Pessi.

          M Offline
          M Offline
          moazzamahmed
          wrote on last edited by
          #4

          excellent. that worked, thanks man. M

          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