Getting a list of all pages and all web parts on one page

Hi, is it possible to get a list of all pages in the portal in, for example, a treeview, with the WebParts info dynamic loaded from Personalization? Something like:

Page1
    WebPart1
        WebPartProperty1
        WebPartProperty2
    WebPart2
        WebPartProperty1
Page2
    WebPart1
....

The pages (info) is actually stored in a DB and retrieved dynamic on loading (pretty much as I tried to explain on my blog).
I'm using a MasterPage and load a Custom Control with Zones in the ContentPlaceHolder. Thank to URL rewriting, I am able to perform Personalization on the rewritten URL and overwriting the Personalization provider.
This means that all my "PersonalizationBlobs" should be retrievable by path. Question is if I can do something with this Blob without actually being on that particular page. And how to get it into "readable" data?

Is there a way that I can create an instance of the PersonalizationManager and set it on retrieving the data for a specific path?
Somthing like...

PersonalizationManager m = new PersonalizationManager();
m.Path = "~/PathSavedInDB/";

Which will allow me to loop through the Zones and WebParts of that page/path?

Thanks


"Dream as if you'll live forever, live as if you'll die today" (James Dean)
0
littlefool
1/22/2008 12:37:58 PM
asp.net.personalization 3779 articles. 0 followers. Follow

4 Replies
738 Views

Similar Articles

[PageSpeed] 53

foreach (WebPartZone wz in WebPartManager1.Zones) 

{

foreach (WebPart wp in wz.WebParts)

{

//your code

}

}


Mark As Answer If my reply helped you.
0
darsho
2/1/2008 6:36:33 PM

yeah, thanks for you reply, but that is only for web parts and web zones on the current executing page. I want to access all zones and web parts of ALL pages (paths in the personalization database) on 1 page.
More sometime like

foreach (path in paths)
   get webpartmanager of path
   foreach (zone)
      foreach (webpart)


"Dream as if you'll live forever, live as if you'll die today" (James Dean)
0
littlefool
2/1/2008 6:56:39 PM

I've seen a solution in Darren Neimke's book "ASP.NET 2.0 Web Parts In Action" (highly recommended) that uses the BuildManager to execute the Page and it loads the Webparts by

WebPartManager.GetCurrentWebPartManager(Page).WebParts;

You can get all webpartpages by

PersonalizationStateInfoCollection psic = PersonalizationAdministration.GetAllState(.,.,.,.);

foreach(PersonalizationStateInfo psi in psic)
{ apply the BuildManager stuff}

 

But I can't exactly remember how the BuildManger.CreateInstanceFromVirtualPath stuff really works. You have to google.

 

Hope this Helps,
hv

0
hveseli
2/1/2008 9:34:20 PM

Thank you very much for the response. It is exactly what I was looking for. As a matter of fakt, I was reading that book but other more urgent things came along so I had to put it aside before I came to that section. I just found it in the book and will have a look at it as soon as I have time again.

Seems like the BuildManager class is indeed the way to execute the page silently and so retrieve the web parts on it :D

I see if I can write an article about it on my blog as soon as I understand the concept.


"Dream as if you'll live forever, live as if you'll die today" (James Dean)
0
littlefool
2/1/2008 10:07:32 PM
Reply:

Similar Artilces:

Is it possible to embed part of one web page into another web page?
Any answers will be highly appreciated.  Thanks. If you can adjust the page you want to embed onto the other page, you could use a .ascx (web forms control).  Then you can add controls to it and just drag and drop it using VS.NET from the Solution Explorer window to the webform.  You can then also embed it onto other pages in that same web project easily by drag n drop.  I hope this helps, it's not exactly a portion of a web page but may be an acceptable alternative for you.Rachel AppelMVP - ASPInsider In order to better answer this, I could use some details as ...

how to navigate the url page in one web application page to another web application page
In my project one solution have 2 web apllications in one folder.like 1.webapplication1 2.webapplication2. in firt webapplication1 i created one aspx page like sample.axpx. in second webapplication2 i created one aspx page like sample2.aspx... in sample2.aspx page have hyperlinl. I need to navigate this hyperlink when i click it go to the sample.axpx. how can i write navigate url for this...help me. ..thanks  As i understand u, you need Multi Project soltuionsee this link, http://community.rainbowportal.net/blogs/jonathans_rainbow_blog/archive/2006/02/19...

how to embed part of one page into another web page?
Any feedback will be highly appreciated.Thanks There is a HTML element called IFrame where you specify the size of the frame and the source URL which will then render that URL inside the IFrame. Philip Beadle (MVP, MCAD, MCT DotNetNuke Core Team) Use IFrame will contain the whole web page, right? How about I want to contain part of the web page? Thank you very much for your reply.  ...

Web page opens second web page, how does first page know when the second one closes?
I have an app written in ASP.NET where one of the web pages opens up a web page in a second window.  When this second web page closes, the first web page needs to update its data.  How do you do this? You can have the child window call a parent method when the user clicks a link to close it. Otherwise, you'd have to set up polling to check for the existence of the child, and refresh if it doesn't exist. Please Mark As Answer posts that helped you."If we learn from our mistakes, I should be brilliant by now." Thanks, this gives me part of the answer...

Do not get expected WEb page on secondary
netware 6.5 sp2 Have setup a web page on a seconary IP address Load appache with the following command line LOAD ADDRESS SPACE = CSMI APACHE2 -f SYS:APACHE2\CSMI\SERVER\HTTPD.CONF Where HTTPD.CONF is set up to Listen 172.16.212.2:80 which is a secondary ip address A display secondary ipaddress at the server lists the seconary ipaddress I can ping the secondary ip address from the client in Remote manager using IP Address management the secondary IP addresses are not listed When I attempt to brose to the HTTP://172.16.212.2 address I do not see the web page I...

List web parts and web part zones from another page
Hi I'm working on an administration page that clones the content of a page within our cms. Thats the easy bit. The difficult bit is I want to be able to clone the webparts, their locations and their content that are on said page. I've been looking at the SqlPersonalizationProvider but dont think i can solve my problem by calling anything within that. I've also been looking at the webpartmanager and there does not seem to be a way of calling the methods within this class to get the content of a different page. Does anyone have any ideas how i would get the web part inform...

Paging Paging Paging
I am trying to do paging with my search results and it isnt working very well. Here is what I've tried and I feel I've tried everything, lol, please help me out. Sub DataGrid1_SortCommand(Sender as object, e as DataGridSortCOmmandEventArgs) DataGrid1.DataBind() End Sub Sub Datagrid1_PageIndexChanged(Sender as object, e as DataGridPageChangedEventArgs) Dim ds as dataSet DataGrid1.CurrentPageIndex = e.NewPageIndex if Session("Search") is nothing then 'Session probably has expired, get the datasource from database Datagrid1.DataSource = ...

How to open another web page from one web page
Hi, I am writing an asp.net(C#) 2.0 web page with a link to another web page by clicking a button control on the page, so how can I link it in the codes? I cannot access another aspx page class within the current aspx page class.  Thanks If you need to re-direct the user to another page after pressing your Button, then use the Response.Write method like so: Response.Redirect("~/Default.aspx")Thanks, EdMicrosoft MVP - ASP/ASP.NET 1) Response.Redirect( "Destination PageName");2) Response.Transfer("Destination PageName");3) Hyperlink(  set Url="...

How to databind control in one web page from another web page
Hi all,  I have a listbox control and a button control in a web page. Once the user clicks the button another web page is opened. The new web page will accept some data from the user which will be used to databind the listbox in the first web page. In other words, the two web pages ( the parent window and the child window) are open at the same time. The child page needs to databind a control in the parent page. Is there a way to do it? I need some code. Thx in advance Update: I hate to do this. Looks like I will have to take help of viewstate and session si...

All web pages hang on web server when one of the web pages calls a run away sql query
Hi: We have a Windows 2003 dedicated web server running the .NET Frameworks 1.0 and 2.0.  We have a SQL Server cluster running SQL Server 2000.  Unfortunately, we do not have a test environment.  I have 2 .NET web sites in production.  My coworker has a voting .NET web page using AJAX on the same server.  The coworker wrote a query that was not indexing properly and when the page fired the query...the cluster went to almost 100% utilization.  My two web pages would hang and show a blank white page on the default.aspx.  Neither of m...

How can an update in one part of a page cause an update in other parts of the same page?
I have an asp.net web page that describes information relating to a single test case in our automated test system. Much of the information is embedded in various controls (ascx files). Some information is displayed in relation to test results and also in a summary table. This means that the same data may be displayed in two places on the same page. This obviously means that when the data is updated in one place, the other part of the page that contains the same data (or the entire page) must also be updated. The data in question is held in grids, so it may be updated, deleted or a new row i...

Simple way to copy web part personalization info from one page to another.
There may be a more elegant solution, but I’ve found that I can slightly extend the SqlPersonalizationProvider class provided by Fredrik Normen (see: http://fredrik.nsquared2.com/viewpost.aspx?PostID=266)  to effectively copy personalization information from one page to another.    My need was fairly specific, and the code below reflects that. However, I’m sure the concept can be generalized and applied to other situations.  Note, for example, that the solution given here applies specifically to “user” scoped personalization.   In my case, I have a single t...

print a web page only one page out
Name: Email: a2899atsinadotcom Product: Firefox Summary: print a web page only one page out Comments: When print a web page, the output only produce 1 page output. In ie7, it can print more than one page. Browser Details: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E) From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it...

show new page when i use frames to render pages and showed in one part of my main page
Hello Mate,i have a main page.in which i am showing folder names (in my project)(right hand side) and when i click a particular folder name, it will show links for web pages in that particular folder.now when i click links it will render using frames those pages and show them in a div tag.So only the second part(left hand side) of my main page will get redirected based on the links that we are clicking.in my error page i have a back button which redirects the user to the login screen.the problem is the error page is also getting rendered through the frames. so the error page is shown in the ...

Web resources about - Getting a list of all pages and all web parts on one page - asp.net.personalization

Apple on a roll with retail expansion in China as it announces 30th store, second this month
China’s current economic problems – share trading suspended for the second time in a week after stocks fell 7% – doesn’t seem to be impacting ...

"The Bill Clinton scandal machine revs back up and takes aim at his wife."
Says the front-page Washington Post teaser: I'm struck by: 1. Calling Hillary Clinton, the dominating presidential candidate, "his wife." 2. ...

Oculus Rift inventor apologises for price tag
Palmer Lucky apologies for earlier comments when he underestimated the price of the virtual reality headset, but still claims it is 'obscenely ...

Female Founders: The State Of The Union
Building a tech company from the ground up and having it succeed is an ambitious goal. Doing that as a female founder and CEO is another beast, ...

Alabama Chief Justice Says Ban On Same-Sex Marriages Still In Effect
Alabama Chief Justice Roy Moore's latest move against marriage equality is "sad & pathetic," Montgomery County Probate Judge Steven Reed tweeted ...

Exclusive: Hillary Clinton on Running and Governing as a Woman
I sat down with Hillary Clinton in October for an exclusive interview for my book, “Broad Influence How Women Are Changing the Way America Works.” ...

Watch Netflix’s new trailers for ‘The Get Down’ and ‘The Crown’
If you thought Netflix had a busy year in 2015, just wait until you see what the streaming company has in store for 2016. Over the next 12 months, ...

Kim Kardashian Wants Kylie Jenner To Stop Acting Like A Diva, Warns Her To Be ‘Perfect’ For Kanye West’s ...
Kim Kardashian had some stern words of advice for half-sibling Kylie Jenner in the preview for Sunday’s episode of Keeping Up with the Kardashians ...

Winners and losers from Hall of Fame election night
Ken Griffey Jr. sets a ballot record and is joined by Mike Piazza in the Hall of Fame's Class of 2016, but who were the other winners and losers? ...

CES 2016: World's first human-carrying drone is the closest we've come to a flying car
Personal mini helicopters that get us from A to B seem like a far away innovation of the future, but we might be closer than that. At CES 2016 ...

Resources last updated: 1/7/2016 1:59:42 PM