Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-06-11
2
Medium Priority
?
569 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 1500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

670 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