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. Adding events to dynamically created controls

Adding events to dynamically created controls

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netquestion
5 Posts 2 Posters 2 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.
  • P Offline
    P Offline
    psid23
    wrote on last edited by
    #1

    Hi, I am dynamically creating asp.net controls at runtime. I have 2 dropdown lists. When I change the item selected in the first drop down list I want to load the second drop-down list. How shall I add the SelectedIndexChanged event handler for the first dropdown list? Please let me know at the earliest since this is really urgent. Thanks in advance. Sid :)

    T 1 Reply Last reply
    0
    • P psid23

      Hi, I am dynamically creating asp.net controls at runtime. I have 2 dropdown lists. When I change the item selected in the first drop down list I want to load the second drop-down list. How shall I add the SelectedIndexChanged event handler for the first dropdown list? Please let me know at the earliest since this is really urgent. Thanks in advance. Sid :)

      T Offline
      T Offline
      thomas_joyee
      wrote on last edited by
      #2

      C# [Control Name].[Event Name]+= new EventHandler(function name); VB AddHandler [Control Name].[Event Name], AddressOf function name Thomas

      P 1 Reply Last reply
      0
      • T thomas_joyee

        C# [Control Name].[Event Name]+= new EventHandler(function name); VB AddHandler [Control Name].[Event Name], AddressOf function name Thomas

        P Offline
        P Offline
        psid23
        wrote on last edited by
        #3

        how will i get the event name when the control name is not available at design time?

        T 1 Reply Last reply
        0
        • P psid23

          how will i get the event name when the control name is not available at design time?

          T Offline
          T Offline
          thomas_joyee
          wrote on last edited by
          #4

          Did you create a variable of dropdownlist? If yes use that variable to select the event. Thomas

          P 1 Reply Last reply
          0
          • T thomas_joyee

            Did you create a variable of dropdownlist? If yes use that variable to select the event. Thomas

            P Offline
            P Offline
            psid23
            wrote on last edited by
            #5

            thanks for the solution :)

            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