Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > how to access the Page from a TreeNode (treeview 's element) : addinga context menu to a treeview

Thread Tools

how to access the Page from a TreeNode (treeview 's element) : addinga context menu to a treeview

Posts: n/a
Hi all,

I have derived the TreeNode class in order to have it templated, and
that works well. However, in the template I put a control (a link to a
menu) that refers to another control (the menu itself) in the page but
outside the template.

It does not work because the inner control (link to a menu) fails to
find the other control, which it searches in its Page attribute. It
looks like the Page property is null when in a template.

The code is in VB.NET, which I like less than C# :

Protected Overrides Sub AddAttributesToRender(ByVal writer As
If Not (System.Web.HttpContext.Current Is Nothing) AndAlso Not
Me.Page Is Nothing AndAlso Me.Enabled AndAlso
Me.ContextMenuToOpen.Length > 0 Then

That test fails because Me.Page is Nothing.

So, how can I set the Page attribute of each TreeNode, or access the
TreeView object from the TreeNode object ?

Thanks in advance,
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
what is equivalent of treenode.nextnode property in webcontrols.treenode tanya foster ASP .Net 3 05-18-2006 05:58 PM
Treeview control. No selected treenode wanted ASP .Net 0 01-23-2006 01:55 PM
Inserting,Deleting and modyfing TreeNode Xml of Treeview naija naija ASP .Net 0 09-28-2004 01:50 AM
populating treeview menu from db(treenode not defined error) naijacoder naijacoder ASP .Net 1 09-15-2004 03:11 AM