CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 11/20/2006 2:17:24 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 43 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
Swati Jain
Asp.Net User
How to access the navigateurl of child of treeview in masterpage to content page?11/20/2006 2:17:24 PM

0/0

TreeView

tr=Master.FindControl("NavigationTree") as TreeView;;

//tr = new TreeView();

//tr =

//(TreeView)this.Master.FindControl("NavigationTree");

Label1.Text = tr.SelectedNode.NavigateUrl;

above code is not working(object reference is not set to an instance of the object)

How to access the navigateurl of

child of treeview in masterpage

to content page?

Master Page

<%

@ master language="C#" %>

<

html xmlns="http://www.w3.org/1999/xhtml">

<

head id="Head1" runat="Server">

<title>Web Site</title>

</

head>

<

body>

<

form id="Form1" runat="Server">

<

table border="1">

<

tr>

<td style="width:140px; vertical-align:top; background-color:#E0E0E0">

<b>Menu</b><br/>

<asp:TreeView id="NavigationTree" Runat="Server"

HoverNodeStyle-Font-Bold="True" RootNodeStyle-ForeColor="Blue">

<Nodes>

<asp:TreeNode Text="Page 1" NavigateUrl="Page1.aspx" Target="frame3">

<asp:TreeNode Text="Page 1-1" />

<asp:TreeNode Text="Page 1-2" />

</asp:TreeNode>

<asp:TreeNode Text="Page 2" >

<asp:TreeNode Text="Page 2-1"/>

<asp:TreeNode Text="Page 2-2"/>

</asp:TreeNode>

<asp:TreeNode Text="Page 3" >

<asp:TreeNode Text="Page 3-1"/>

<asp:TreeNode Text="Page 3-2">

<asp:TreeNode Text="Page 3-2-1"/>

<asp:TreeNode Text="Page 3-2-2"/>

</asp:TreeNode>

</asp:TreeNode>

</Nodes>

</asp:TreeView>

</td>

<td style="width:350px; vertical-align:top">

<asp:ContentPlaceHolder id="CONTENT" Runat="Server"/>

</td>

</

tr>

</

table>

</

form>

</

body>

</

html>
haoest
Asp.Net User
Re: How to access the navigateurl of child of treeview in masterpage to content page?11/20/2006 5:58:17 PM

0/0

 Where are you running this:
TreeView tr=Master.FindControl("NavigationTree") as TreeView;; 
//(TreeView)this.Master.FindControl("NavigationTree"); 
Label1.Text = tr.SelectedNode.NavigateUrl;

 ?

It should work, unless your content page is not using the master page you have specified above.

 


Debugger is my best friend.
Iori_Jay
Asp.Net User
Re: How to access the navigateurl of child of treeview in masterpage to content page?11/21/2006 6:26:19 AM

0/0

Are you sure tr.SelectedNode is pointing to some node when you try to access its NavigateUrl? If a TreeNode is selected and it has NavigateUrl defined, then after selecting the TreeNode you'll be redirected to the Url defined in NavigateUrl, even if the NavigateUrl is pointing current page, the TreeNode will be re-initialized to unselected so the object reference not set exception comes out.

Workaround here should be using something like ViewState or Session, here are some useful links:

ASP.NET State Management Recommendations
How to: Pass Values Between ASP.NET Web Pages

Welcome to my SQL/ASPNET forum for Chinese
http://51up.org/bbs/forumdisplay.php?fid=38
3 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
How to access the navigateurl of child of treeview in masterpage ... How to access the navigateurl of child of treeview in masterpage to content page ? Last post 11-21-2006 1:26 AM by Iori_Jay. 2 replies. ...
How to access the child node of treeview in masterpage to content ... How to access the child node of treeview in masterpage to content page? ... ...
MasterPage - ContentPlaceHolder - How to navigate to the ... Similar to what would happen in the "navigateURL" property when clicking on ... using a treeview on my master page, and depending on the ...
How To Hightlight the Tree View Navigation Selected Child Node ... NET. I have the tree view navigation control on my Master.Master page. ... This is because your child nodes have NavigateUrl. When the child nodes are ...
CodeProject: Inside Master Pages. Free source code and programming ... but how to access control places in content page from master page ? ... to do is from the content page, set the Text and NavigateUrl properties of "hlTest". ...
ASAP to ASP.NET 2.0 Master page child controls initialization; Content page child controls ... The end user can access these personalization properties on later site visits. ...
Navigate hierarchical site data with ASP.NET’s TreeView control ... Aug 14, 2007 ... The following example uses a TreeView control in a master page, ... You may also populate the TreeView control with static content. ...
ASP.NET Tutorial As in previous examples, this menu is coded on the master page for the site. ..... and NavigateUrl property names used by the TreeView to produce a menu. ...
Multiple Pages and Site Navigation - C# Tutorials Navigation levels can be set to expand or collapse if they contain child categories. I have placed my TreeView object in the master page and contained with ...
DotNetBips.com :: Blossom your .NET skills Aug 17, 2008 ... Then add a new Master Page to the web site called MasterPage.master. ... rows and set their Text and NavigateUrl properties as shown below: ...




Search This Site:










2.0 menu control skin / shadows

can a masterpage have code behind?

how can i choose which sitemap i want the sitemap path (breadcrumbs) to run off

submission page completion control

master page

selectednodestyle imageurl is a bust...

personalization to ignore case in url?

master, content and postback

stylesheets & masterpages?

creating a template for a 2-column main content page

how to use a property defined in .master?

print only the content and not the other items in the master page?

external master

how to remove buttons on wizard control?

problem with asp:menu

problem with masterpage

how do you add controls to master page dynamically?

how do you set the page titles on a master theme subpage

how can i collapse treeview?

organizing site with content place holder in master page confusing to newbie

how to handle masterpage's event in content page? (c#)

how to: display a page in another page who's content of a masterpage without an iframe?

css menu to bind to sitemapdatasource

access a control on a master form from .aspx page

body background image (css) and themes

is it possible have shadow on menu control?

image map - defining the hotspots?

help: applying a skin to a dynamic control.

why does menu control not show subnavs unless page refreshed?

imagebutton problem!

  Privacy | Contact Us
All Times Are GMT