Hi All,
I created a Master Page with a Treeview, in the page_load() I got the following...
Partial
Class Report
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim Child1 As TreeNode = New TreeNode()
Dim Root1 As TreeNode = New TreeNode()
If Not IsPostBack Then
Root1.Text =
"My Reports"
Child1 =
New TreeNode()
Child1.Text =
"Report #1"
Root1.ChildNodes.Add(Child1)
TreeView1.Nodes.Add(Root1)
End If
End Sub
End
Class
I also created a test4.aspx web page that use this Report.Master and when I ran the page I got the following error.
Server Error in '/OTP_Checklist' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 12: Child1.Text = "Report #1"
Line 13: Root1.ChildNodes.Add(Child1)
Line 14: TreeView1.Nodes.Add(Root1)
Line 15: End If
Line 16:
|
Source File: C:\Documents and Settings\slau\My Documents\Visual Studio 2005\OTP_Checklist\Report.master.vb Line: 14
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Report.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\slau\My Documents\Visual Studio 2005\OTP_Checklist\Report.master.vb:14
System.Web.UI.Control.OnLoad(EventArgs e) +80
System.Web.UI.Control.LoadRecursive() +49
System.Web.UI.Control.LoadRecursive() +132
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3745
|
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
How could I control or display the nodes of the treeview in the master page?
TIA
Steve