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. Advertisements

  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. Advertisements

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. Atif Jalal
    Replies:
    0
    Views:
    537
    Atif Jalal
    May 26, 2004
  2. Nikhil Patel
    Replies:
    3
    Views:
    3,040
    Ken Cox [Microsoft MVP]
    Oct 7, 2004
  3. Pravin
    Replies:
    2
    Views:
    392
    Pravin
    Jan 14, 2005
  4. =?Utf-8?B?U2lsdmVyIE9haw==?=

    How to raise event on dynamically created textbox control in DataG

    =?Utf-8?B?U2lsdmVyIE9haw==?=, Nov 10, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    956
    =?Utf-8?B?U2lsdmVyIE9haw==?=
    Nov 10, 2006
  5. Replies:
    0
    Views:
    898
  6. Warren Tang
    Replies:
    1
    Views:
    760
    Warren Tang
    Sep 17, 2008
  7. msimmons
    Replies:
    0
    Views:
    781
    msimmons
    Jul 16, 2009
  8. Adi
    Replies:
    2
    Views:
    325
Loading...