Welcome Guest Search | Active Topics | Sign In | Register

Treeview - Adding a custom control programmatically Options
kennaxx
Posted: Tuesday, May 12, 2009 10:42:34 AM
Rank: Advanced Member
Groups: Member

Joined: 4/30/2009
Posts: 36
I have done a search on this topic, but found nothing. I can see your demo on how to add a custom control manually, but how can you add one programmatically at runtime?

TrvGroup.Nodes.Add() ?

Thanks Kennaxx
eo_support
Posted: Tuesday, May 12, 2009 10:48:04 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You will need to add a CustomItem dynamically first. You can place a Panel in your page then dynamically add a CustomItem into that Panel. Once you added the CustomItem, add a TreeNode as usual and then set that node's CustomItemID to the ID of the newly added CustomItem.

If you are only adding simple HTML element such as a CheckBox or an ImageButton, it may be easier for you to set the TreeNode's Text to some raw HTML directly.

Thanks!
kennaxx
Posted: Saturday, June 6, 2009 8:22:42 PM
Rank: Advanced Member
Groups: Member

Joined: 4/30/2009
Posts: 36
EO,

Should this not create a custom embedded HyperLink Object? It does create a node but it does not show as Hyperlink.

Thanks

EO.Web.CustomItem newItem = new EO.Web.CustomItem();
HyperLink link = new HyperLink();
link.Text = "Please Click Me";
newItem.Controls.Add(link);
EO.Web.TreeNode RootNodex = new EO.Web.TreeNode();
RootNodex.Text = "Fox";
RootNodex.Value = "";
RootNodex.CustomItemID = "newItem";

myNode.ChildNodes.Add(RootNodex);
eo_support
Posted: Saturday, June 6, 2009 8:30:59 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

There are two problems in your code:

1. You need to add the CustomItem into your page. When you set a Node's CustomItemID, it points to that CustomItem, which itself must exist in the page;

2. You need to set the HyperLink's NavigateUrl property. HyperLink is useless unless you set NavigateUrl;

Thanks
kennaxx
Posted: Saturday, June 6, 2009 8:58:22 PM
Rank: Advanced Member
Groups: Member

Joined: 4/30/2009
Posts: 36

Thanks EO. It working fine now.

THanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.