How to attach an event to dynamically created control in VB.NET

Discussion in 'ASP .Net' started by =?Utf-8?B?TmlybWFsa3VtYXI=?=, Jan 12, 2005.

  1. How to attach an event to dynamically created control in VB.NET

    I have dynamically created dropdown list in code behind (VB.NET). For this
    control I want to attach an event for action ‘OnSelectedIndexChanged’.

    What is the property to assigne an event to a dynamically created dropdownlist
    =?Utf-8?B?TmlybWFsa3VtYXI=?=, Jan 12, 2005
    #1
    1. Advertising

  2. You can do this using the AddHandler keyword.
    eg.
    AddHandler myDropDownList.SelectedIndexChanged, AddressOf
    Me.myDropDown_OnSelectedIndexChanged

    --
    Philip Q
    Microsoft MVP [ASP.NET]

    "Nirmalkumar" <> wrote in message
    news:...
    > How to attach an event to dynamically created control in VB.NET
    >
    > I have dynamically created dropdown list in code behind (VB.NET). For this
    > control I want to attach an event for action 'OnSelectedIndexChanged'.
    >
    > What is the property to assigne an event to a dynamically created
    > dropdownlist
    >
    Philip Q [MVP], Jan 12, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nikhil Patel
    Replies:
    3
    Views:
    2,840
    Ken Cox [Microsoft MVP]
    Oct 7, 2004
  2. Replies:
    0
    Views:
    647
  3. Warren Tang
    Replies:
    1
    Views:
    537
    Warren Tang
    Sep 17, 2008
  4. msimmons
    Replies:
    0
    Views:
    470
    msimmons
    Jul 16, 2009
  5. Adi
    Replies:
    2
    Views:
    190
Loading...

Share This Page