How to detect current note is set to home?
Hi,
My challenge is to programatically detect whether the current node is set to home. I'm developing a custom control and I need that to behave differently in the pages set as Home under different page groups. A quick response would be highly appriciated.
Thanks,
Duneel
Hi Duneel,
You can get the current SiteMapNode and compare its id to the home page id
PageSiteNode result =
null
;
SiteMapProvider provider = SiteMapBase.GetCurrentProvider();
result = provider.CurrentNode
as
PageSiteNode;
var homePageId = Config.Get<PagesConfig>().HomePageId;
Hello Ivan,
Thank you very much for the instructions. Using the sample code provided I can find the ID of the Home page. Now I have another problem. I was thinking each sub division (page group) can have it's own home page. but later found that there can be only one home page withing the whole instance.
Now the challenge is to identify the default landing page of a page group. Can I programatically detect if the page is the default landing page of a page group? The website I'm developing has 4 sub sites (seperated by page groups having it's own landing group).
Thanks,
Dunee!
Hi Duneel,
If the current page has parent page which does not have PageData, then this page is the first landing page of the page group. You can check this post
Greetings,
Ivan Dimitrov
the Telerik team
Thanks Ivan. It solved my problem.