Vulnerability in EPiServer.Forms
I am using EPiServer 6 with ASP.Net.
How can i get full PageTreeView (from left panel of EPiServer) in a collection or var (all PageTreeView like parent --> child --> subchild --> .... )
I'm assuming you want to display the page tree somewhere on a content page.
There is actually a webcontrol that does this for you (<episerver:PageTree>) - see https://sdk.episerver.com/library/cms6/html/T_EPiServer_Web_WebControls_PageTree.htm
If you need the tree in a collection (e.g. to bind to a TreeView control), you could do EPiServer.DataFactory.GetDescendents(pageref_of_your_startpage) - see http://sdk.episerver.com/library/cms6.1/html/M_EPiServer_DataFactory_GetDescendents.htm. Note that this just returns a list of PageReferences, not PageData objects.
Alternatively you could do a recursive EPiServer.DataFactory.GetChildren call (this only gets the direct child pages of a given parent page, but returns a PageDataCollection that you could bind to your treeview control).
Be aware that retrieving the entire page tree may have a huge impact on performance.
Thanks for your reply!
Using below method, i can get only full PageLink ID.
EPiServer.DataFactory.GetDescendents(pageref_of_your_startpage). But i want to get full tree with value(name of the node & Page link).
For eg: Below are the tree structure and i want to get full pagelink ID with node name (eg. Parent node 1, child 1) in a collection.
- Parent node 1
- Child 1
- Subchild 1
- Subchild 2
- Child 2
- Subchild 1
- Subchild 2
- Parent node 2
You put the result of GetDescendents() as input to DataFactory.Instance.GetPages(). There you will get a full PageDataCollection.
I have arroung 900 PageLink ID and i want to filter based on there node name. I'm already using below method under foreach loop to filter the data.
But due to large amount of PageLinkID, the performance of website is very slow. that's why i'm asking for this.
Is there any way to get full Tree PageLink ID with Name of the node in sigle hit (for eg: below tree structure)???
- SubChild 11
- SubChild 12
Maybe this is what your're after?
var criterias = new PropertyCriteriaCollection
Name = "PageName",
Type = PropertyDataType.String,
Value = "Parent node",
Condition = CompareCondition.StartsWith,
Required = true
PageDataCollection result = DataFactory.Instance.FindPagesWithCriteria(PageReference.StartPage, criterias);
Thanks for your help!
I'm new in EPiServer, that's why i'm asking again n again.
Using this method "FindPagesWithCriteria", i'm getting only single page data not all tree Page ID with corresponding Node name. I want to get Full Tree PageID with corresponding node name in single hit (not require page data only tree structure require with Tree Page ID & Name of the node).
If you need to have PageName available I think all built-in APIs require you to retrieve full PageData objects.
If your site has EPiServer Find you can use "projections" and only retrieve and transfer a few specified properties:http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/9/DotNET-Client-API/Searching/Projections/
I want to get data from "tblWorkPage" table based on some PageID.
How can i write the code to access data from "tblWorkPage" table in code behind (asp.net with c#).
It's not recommended to fetch EPiServer data directly from the database tables but if you were to do it still you could use SqlClient and a DataReader as you would with any SQL Server database table.
Thanks Johan for your help :)
I'm still struggling to find the way to resolve this. :(