Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 26th, 2012, 02:15 PM
Authorized User
 
Join Date: Dec 2011
Posts: 18
Thanks: 1
Thanked 0 Times in 0 Posts
Default change web.sitemap nodes programmatically

Hi,
i m trying to change the sitemap node text/titles in the code.
i m trying to assign custom label names.CustomLabel.GetCustName(sitemapnode.Title); will assign a new label. but when i change it for the first time it will change perfectly but it wont let me do it second time,, it wont change the text name until i rebuild the project and run the application.
i m not sure what should i do to fix this. any ideas? thanks is advance

if (c is SiteMapDataSource)
{
SiteMap.RootNode.ReadOnly = false;
SiteMap.CurrentNode.ReadOnly = false;
foreach (SiteMapNode sitemapnode in SiteMap.RootNode.ChildNodes)
{
sitemapnode.ReadOnly = false;
sitemapnode.Title = CustomLabel.GetCustName(sitemapnode.Title);
sitemapnode.Description = CustomLabel.GetCustName(sitemapnode.Description);

foreach (SiteMapNode subsitemapnode in sitemapnode.ChildNodes)
{
subsitemapnode.ReadOnly = false;
subsitemapnode.Title = CustomLabel.GetCustName(subsitemapnode.Title);
subsitemapnode.Description = CustomLabel.GetCustName(subsitemapnode.Description );
}
}

}[/RIGHT][/RIGHT][/RIGHT][/RIGHT]
[/LEFT]
 
Old February 27th, 2012, 02:54 AM
Friend of Wrox
 
Join Date: Nov 2009
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Smile

Hi there

for any xml files you can use XmlDocument (System.Xml) to modify the file:

see the link below. if not helpful notify me to send a simple sample

http://www.codeproject.com/Articles/...-XmlDocument-C
__________________
happy every time, happy every where

Reza Baiat
 
Old March 2nd, 2012, 12:35 PM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Hi,
although link you provided is useful, but if you have something different to say then I am interested...





Similar Threads
Thread Thread Starter Forum Replies Last Post
Change TextBox properties programmatically perstam BOOK: WPF Programmer's Reference: Windows Presentation Foundation with C# 2010 and .NET 4 3 June 3rd, 2010 12:07 PM
Make sitemap child nodes clickable in menu jmiguy ASP.NET 3.5 Basics 0 December 18th, 2009 10:21 PM
change programmatically color of a detailsview hertendreef ASP.NET 2.0 Professional 3 June 22nd, 2006 01:34 PM
Programmatically Change Printer Settings vempativenu Beginning VB 6 0 September 2nd, 2004 06:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.