Results 1 to 4 of 4

Thread: How may I handle click-events for objects that I stored in a placeholder?

  1. #1

    Thread Starter
    Hyperactive Member fabianus's Avatar
    Join Date
    Sep 2004
    Location
    Paris
    Posts
    402

    Resolved How may I handle click-events for objects that I stored in a placeholder?

    How may I handle click-events for objects that I stored in a placeholder?
    For example a button or a treeview? I would like to run a code once the user clicks on the object.

    Thank you very much for any advice.
    Last edited by fabianus; May 16th, 2005 at 12:22 AM.

  2. #2
    New Member
    Join Date
    May 2005
    Posts
    1

    Re: How may I handle click-events for objects that I stored in a placeholder?

    Firstly there is no native TreeView in ASP.NET only in .NET WinForms. In asp.net 2.0 there will be a native TreeView.

    So you have to make your own treeview or get some component.

    There is no difference on events on buttons and so on from when they are placed in placeholders. The event is on the object itself. Like:
    PlaceHolder1 = new PlaceHolder();
    System.Web.UI.WebControls.Button btn = new System.Web.UI.WebControls.Button();
    btn.Text = "Test";
    btn.Click += new EventHandler(btn_Click);
    PlaceHolder1.Controls.Add(btn);

    And the you have the eventhandling code in the corresponding btnClick method:

    protected void btn_Click (object sender, System.EventArgs e)
    {
    //some eventhandling. This code will run when clicked
    }

    Hope it helps.

  3. #3

    Thread Starter
    Hyperactive Member fabianus's Avatar
    Join Date
    Sep 2004
    Location
    Paris
    Posts
    402

    Question Re: How may I handle click-events for objects that I stored in a placeholder?

    Hi Footracer,

    Thank you very much for your explanation that gave me some very interesting material.
    I tried different things, but I couldn't manage the following:

    I have a treeview object (from Microsoft web controls)
    Info here:
    http://msdn.microsoft.com/library/de...rols_entry.asp

    They explain how make an event handler when clicking on a node, but only for C# and I tried everything to put it into VB, but my knowledge does not go fare enough for that. Do you have an idea how to do?

    http://msdn.microsoft.com/workshop/w..._with_TreeView

    Thank you very much in advance.

    Fabian
    Last edited by fabianus; May 13th, 2005 at 07:58 AM.

  4. #4

    Thread Starter
    Hyperactive Member fabianus's Avatar
    Join Date
    Sep 2004
    Location
    Paris
    Posts
    402

    Resolved Re: How may I handle click-events for objects that I stored in a placeholder?

    Finally I got it!
    Thank you.

    Fabian

Posting Permissions

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



Click Here to Expand Forum to Full Width