Solved

Value of type 'System.Web.UI.Control' cannot be converted to 'System.Web.UI.WebControls.TreeNode' !!

Posted on 2008-06-11
2
559 Views
Last Modified: 2008-06-15
Hi,

I have the following:

Request("Id") => Which represents the ID of the TreeNode.

I want to get the TreeNode from this. I have used the following syntax but never works for me:

Dim node As TreeNode = CType(FindControl(Request("Id")), TreeNode)

Error:

Value of type 'System.Web.UI.Control' cannot be converted to 'System.Web.UI.WebControls.TreeNode'

Can you please give me the correct syntax ?

Thanks
0
Comment
Question by:milani_lucie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Expert Comment

by:fanopoe
ID: 21763589
is sender one of the inputs to your procedure?
that gives you a reference that will either be direct or that you should be able to drill through to what you need.
0
 
LVL 16

Accepted Solution

by:
ororiole earned 500 total points
ID: 21763842
TreeNode unlike other controls does not inherit from System.Web.UI.Control. It inherits direct from System.Object only. So you can't find it using FindControl. It also does not have an ID property. You will have to go into the TreeView collection and search for it.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question