|
-
May 12th, 2005, 08:17 AM
#2
New Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|