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. How to fire the DropDownList.SelectedIndexChanged event

How to fire the DropDownList.SelectedIndexChanged event

Scheduled Pinned Locked Moved ASP.NET
tutorialcsharpsysadminhelp
5 Posts 2 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
    MacIntyre
    wrote on last edited by
    #1

    I have a vb.net (WebForm) program that is for initial data entry and if the transaction needs to be corrected it doubles as Edit/Update. I have a series of DropDownLists that work perfect when in initial entry mode. The problem comes when re-populating the transaction and appropiate dropdownlists are being populated in the code-behind. The problem is that the dropdownlists need to be populated with all employees and then the specific employee that is to appear (normally selected, now force selected in code-behind) does not fire the SelectedIndexChanged Event a second time without a page level update. Normally just changing the SelectedValue will cause the correct employee to appear. But, all of the elements of the dropdownlist have just been set, so the system does not recognize the new selection as one that is to be displayed. With SelectedIndexChanged being a "Server Side" Event is there a way to force this event from the clientside in code-behind? Or maybe there is a way to reset the selectedindexchanged property to think is has not been changed yet? If so, could you be kind enough to supply an example?

    A 1 Reply Last reply
    0
    • M MacIntyre

      I have a vb.net (WebForm) program that is for initial data entry and if the transaction needs to be corrected it doubles as Edit/Update. I have a series of DropDownLists that work perfect when in initial entry mode. The problem comes when re-populating the transaction and appropiate dropdownlists are being populated in the code-behind. The problem is that the dropdownlists need to be populated with all employees and then the specific employee that is to appear (normally selected, now force selected in code-behind) does not fire the SelectedIndexChanged Event a second time without a page level update. Normally just changing the SelectedValue will cause the correct employee to appear. But, all of the elements of the dropdownlist have just been set, so the system does not recognize the new selection as one that is to be displayed. With SelectedIndexChanged being a "Server Side" Event is there a way to force this event from the clientside in code-behind? Or maybe there is a way to reset the selectedindexchanged property to think is has not been changed yet? If so, could you be kind enough to supply an example?

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      I think you shouldnt rely on serverside events. Rather call the method to repopulate the control yourself. :)

      Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


      My Latest Articles-->** Simplify Code Using NDepend
      Basics of Bing Search API using .NET
      Microsoft Bing MAP using Javascript

      M 2 Replies Last reply
      0
      • A Abhishek Sur

        I think you shouldnt rely on serverside events. Rather call the method to repopulate the control yourself. :)

        Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


        My Latest Articles-->** Simplify Code Using NDepend
        Basics of Bing Search API using .NET
        Microsoft Bing MAP using Javascript

        M Offline
        M Offline
        MacIntyre
        wrote on last edited by
        #3

        I agree with you on that. Please follow the logic here and make a suggestion with code sample if appropiate. This is a bound dropdownlist.. DataFieldText = EmployeeName DataFieldValue = EmployeeID So I Deliver all of the employees to the DropDownList first and that works. All Employees are in the dropdownlist just fine. On the update path in the program, before the first display of the page, I set SelectedValue = EmployeeID, for the employee to be edited. This should cause that employee info to be displayed when the page is presented for the first time and it is not... Any ideas on why? Thanks in advance for your assistance.. Chuck...

        1 Reply Last reply
        0
        • A Abhishek Sur

          I think you shouldnt rely on serverside events. Rather call the method to repopulate the control yourself. :)

          Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


          My Latest Articles-->** Simplify Code Using NDepend
          Basics of Bing Search API using .NET
          Microsoft Bing MAP using Javascript

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

          Problem resolved.. Appears to have been a combination of programmer error and Data corrupted by the infamous Trailing SPACE. Thanks for your input. Made me go back and go line by line and letter by letter...

          A 1 Reply Last reply
          0
          • M MacIntyre

            Problem resolved.. Appears to have been a combination of programmer error and Data corrupted by the infamous Trailing SPACE. Thanks for your input. Made me go back and go line by line and letter by letter...

            A Offline
            A Offline
            Abhishek Sur
            wrote on last edited by
            #5

            Wow.. Thats great to hear that. :cool::thumbsup:

            Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


            My Latest Articles-->** Simplify Code Using NDepend
            Basics of Bing Search API using .NET
            Microsoft Bing MAP using Javascript

            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