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

A

abargaddon

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
System.Web.UI.HtmlTextWriter)
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,
Abargaddon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top