473,383 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How do I use a treeview with a sitemap file from another web site?

Hello,

I want to show a treeview display of the contents of a sitemap file on
another web site, chosen according to the currently logged on user. I
know at run time the path to the sitemap file, but this cannot be
determined at design time as it depends who logs in.

Can I do this? I can't see how without writing my own provider, which
seems like a lot of work for such a simple request?

TIA

--
Alan Silver
(anything added below this line is nothing to do with me)
Dec 19 '05 #1
6 1696
use:

System.Net.WebClient wc = new System.Net.WebClient();
byte[] response = wc.UploadData("http://address.com/settingsFile?user=" +
userId, "GET", null);

string strResponse = System.Text.Encoding.ASCII.GetString(response);
Dec 19 '05 #2
Thanks for the reply. Sorry, I wasn't clear what I meant.

I have full access to the server, and both web sites are on the same
server, so accessing the sitemap file itself is just a case of getting
the right path, which is easy.

My question was more how to load a sitemap file that isn't called
"web.sitemap" in the current web site. The SiteMapDataSource doesn't
seem to have an option for specifying the sitemap file to use, it just
assumes that you want to use the current site's "web.sitemap." I would
like to know if there is a way of loading a different sitemap file (even
another one in the same web site for that matter) so it can be used.

Thanks for the reply. Any further help appreciated.
use:

System.Net.WebClient wc = new System.Net.WebClient();
byte[] response = wc.UploadData("http://address.com/settingsFile?user=" +
userId, "GET", null);

string strResponse = System.Text.Encoding.ASCII.GetString(response);


--
Alan Silver
(anything added below this line is nothing to do with me)
Dec 20 '05 #3
>Does this help
http://msdn2.microsoft.com/library/ms178426.aspx


Partly, and partly not. Is it possible to specify the file in at
run-time? The situation is that I have an admin site that is used by
people who use my e-commerce package. There is one admin site, and this
is used by everyone. They log in, and the user name is used to identify
the path to the root directory of their web site. I want to use that
path to load up their web.sitemap file.

I don't really want to add the sitemap files to the web.config file as
this means duplicating information, which is bound to cause problems. At
the moment, there is one config file per site, living in the App_Data
folder of the site. The admin site knows the path to each site, so it
can just pick up the config file, and anything else it wants from the
user site.

What I would really like is some way of telling the SiteMapDataSource
(or similar) at run-time which sitemap file to load. This seems to
simple and obvious, but I can't see how to do it.

Any further suggestions appreciated. Thanks again.

--
Alan Silver
(anything added below this line is nothing to do with me)
Dec 20 '05 #5
You might have to create a customer SiteMapProvider, and if you go through
all that trouble you might want to think about incorporating it into your
database, since the siteMap will be based on the user.

http://msdn2.microsoft.com/library/s...pprovider.aspx
Look at the LoadSiteMapFromStore function

Dec 20 '05 #6
>You might have to create a customer SiteMapProvider, and if you go through
all that trouble you might want to think about incorporating it into your
database, since the siteMap will be based on the user.

http://msdn2.microsoft.com/library/s...pprovider.aspx
Look at the LoadSiteMapFromStore function


Thanks for that.

It occurred to me that maybe I'm thinking about this the wrong way. The
web.sitemap file is just an XML file, so maybe I should just declare an
XmlDataSource and set the DataFile property to the web.sitemap file. I
can then use the XmlDataSource as the data source for the tree view.

This turned out to be very easy!! Sample code is shown below...

<asp:TreeView id="BookTreeView" DataSourceID="BookXmlDataSource"
runat="server">
<DataBindings>
<asp:TreeNodeBinding DataMember="siteMapNode" TextField="Title"/>
</DataBindings>
</asp:TreeView>

<asp:XmlDataSource id="BookXmlDataSource"
DataFile="D:\WebSites\TestSite\web.sitemap" runat="server" />

This has the path to the file hard-coded for testing. In the real code,
I would just do that bit at run-time.

All I have to do now is work out how to control the treeview. I would
like to start the treeview displaying at the first SiteMapNode, ignoring
the SiteMap node that is at the root of the sitemap file. Any ideas
about this?

Thanks

--
Alan Silver
(anything added below this line is nothing to do with me)
Dec 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alan Silver | last post by:
Hello, I have a web.sitemap file that is used as the data for a treeview control. This shows the site structure very well, but I would like to add the description (in the siteMapNode element in...
10
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a...
2
by: Andy Sutorius via DotNetMonster.com | last post by:
I have a current website divided into 2 sections. Each section needs it's own sitemap and treeview. Is it possible to have 2 different sitemaps in a website? Everything that I have read says you...
0
by: jim | last post by:
Hi, I have a TreeView control that sits on the MasterPage. All of my other webpages inherit from that Master Page. The Treeview receives it's data using an XMLDataSource that has it's DataFile...
5
by: Tim Mackey | last post by:
hi, i have put my web.sitemap in /App_Data so i can edit it programatically via a web admin page, inheriting the modify permissions from the App_Data folder etc. i was hoping the provider would...
0
by: noneya22 | last post by:
I want to use a TreeView control as a one-level, vertical navigation menu. I'm using this control currently with a SiteMapDataSource and .sitemap file. I've written code that associates an image...
1
by: Robert Dufour | last post by:
In Vs2005 VB.net. How do you localize the title and the description of the pages in the web.sitemap file? For instance in the simple sitemap below <?xml version="1.0" encoding="utf-8" ?> ...
4
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
Hi, I am using VB.Net version 2 in a web application. I have a Navigation TreeView that is powered by a SiteMapDataSource linked to Web.sitemap file. This all works well. My questions is,...
0
by: vingomail | last post by:
Good Morning, I have two site map: "common.sitemap, loginuser.sitemap", two master page:" common.master, loginuser.master", in common.master, there is a Navigation control: TreeView...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.