PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Handling Event for Runtime created control - ASP.NET-VBForums
Results 1 to 2 of 2

Thread: Handling Event for Runtime created control - ASP.NET

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2004
    Location
    Croatia
    Posts
    23

    Handling Event for Runtime created control - ASP.NET

    I'm using VS. NET 2005.

    How to handle events in ASP.NET web pages, of controls created in run time.

    VB Code:
    1. '.
    2.         '.
    3.         Dim ln As Integer = uItems.Count - 1
    4.         Dim n As Integer
    5.         Dim btn(ln + 1) As ImageButton
    6.  
    7.      
    8.         For n = 0 To ln
    9.             btn(n) = New ImageButton
    10.             btn(n).ImageUrl = "DELETE.BMP"
    11.             ButtonPanel.Controls.Add(btn(n))
    12.         Next n
    13.         '.
    14.         '.
    In this case, how to handle click events by runtime addeded ImageButton controls ---> btn(n).

    I want to do something when user clicks on <new> ImageButton(s). How to create one procedure that will handle all ImageButton clicks and that will know which button was clicked!

    Please help and sorry about my english!

  2. #2
    Addicted Member Smie's Avatar
    Join Date
    Jun 1999
    Location
    Columbus, OH
    Posts
    249

    Re: Handling Event for Runtime created control - ASP.NET

    You have the right idea, but you will want to wire the click event with an AddHandler statement....

    This should answer all your questions and get you on your way:
    http://forums.asp.net/1138565/ShowPost.aspx
    "There are two ways to write error-free programs. Only the third one works."

    "Real programmers don't comment their code. If it was hard to write, it should be hard to understand."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width