Is there a way to programmatically set the current node of a SiteMapPath control? - asp.net-2.0

My site has a few pages that point to the same child page. I'm using a xml site map that will not allow me to duplicate a SiteMapNode with the same Url. My idea was then to give my SiteMapPath control a parent node to populate itself from, and then add on a SiteMapNode of the current page.
Has anyone else had to do something similar? I've looked at this article http://msdn.microsoft.com/en-us/library/ms178425.aspx which describes how to "Programmatically Modify Site-Map Nodes in Memory" but they are including the SiteMapNode in the file and then just modifying that node by inspecting the querystring.
My node never exists, or if it is I'd need to copy it over to the correct parent so it could render the correct path. For a visual:
Home
--My Page
----Page A
----Page B
----Page C
--My Other Page
----Page A
----Page D
--YAPage
----Page B
----Page C
Some examples of what I'd like to see:
Home > My Page > Page A
Home > My Other Page > Page A
Home > My Page > Page B
Home > YAPage > Page B

Looks like these are going to solve the problem:
http://www.codeproject.com/KB/aspnet/ABetterSiteMapResolve.aspx
http://netpl.blogspot.com/2008/04/sitemapresolve-and-dynamic-site-map.html
For dynamic sitemaps:
http://www.codeproject.com/KB/aspnet/dynamicsitemap.aspx
With multiple provider's you'll need to use this instead to attach the SiteMapResolve event: (If your event isn't firing most likely you don't have the correct provider set.)
SiteMap.Providers[currentProvider].SiteMapResolve += new SiteMapResolveEventHandler(Provider_SiteMapResolve);

Related

how to authorize user into multiple page and vice versa

I creating a website using asp. I want the security will be like this, person1 can access page1, page2, and page3 while person2 can access the page2 and page3 then person3 can access the page4 and page3. Is this possible? and how?
You can achive it in two ways :
1st Way: Creating page level access:- most common for small website
Steps to follow:
Create page object in database with read write and update accessibility
Table view -> id int primary key| page name | read (boolean)| write (boolean) | update (boolean )
Once created create page for creating role for segments of pages
create page for adding user to role
on your master page after login, check user accessibility and make navigation bar visible of false and make a global class with page accessibility (you can use property for setting that up )
on page load of each page check accessibility and do what you want
2nd way: Creating role based access
When we create large application it have segments of work related to each other of different pages
We create segments (steps to follows as one unit )
Save that segment in database with linking of module
create role by selecting multiple segments
attached it with users and follow same steps as in 1st step

DNN module control doesnt' use page template

I have module which is a list of elements. I want to be able to click in a element and go to a control which show detailed information and stuff.
Problem is that when I go to that control the asigned page template is changed; don't know if it normal behavior and if it is: how do I force the asigned template?
NOTE: I don't want to change the admin template in order to achieve that
Hope it is enough information and help some people in the future.
Thanks in advance!
The best approach I found was "Dynamically Loaded Controls"
A developer can use a placeholder control on their module:
<asp:PlaceHolder id="phDynamicPlaceHolder" runat="server"></asp:PlaceHolder>
and dynamically load a control into the placeholder.
Select Case Me.rblDynamicControl.SelectedValue
Case 1
DynamicPage = DotNetNuke.Common.ResolveUrl(Me.TemplateSourceDirectory & "/DynamicControls/control1.ascx")
Case 2
DynamicPage = DotNetNuke.Common.ResolveUrl(Me.TemplateSourceDirectory & "/DynamicControls/control2.ascx")
End Select
Dim objModule As Entities.Modules.PortalModuleBase = CType(Me.LoadControl(DynamicPage), DotNetNuke.Entities.Modules.PortalModuleBase)
If Not objModule Is Nothing Then
objModule.ModuleConfiguration = Me.ModuleConfiguration
phDynamicPlaceHolder.Controls.Add(objModule)
End If

How to implement SiteCatalyst inbuilt variable 'pageType' in DTM?

I am trying to implement SiteCatalyst's inbuilt variable 's.pageType' using DTM (which we use to capture the 404 error pages).
I can definitely write this piece of code in DTM's s.code:
s.pageType="errorPage"
But the problem is the condition which would identify if the page is 404 error page or not, can be identified only at page code level (as per developers, there are exceptions which is thrown if error page comes up, which can be used to identify this condition on the page), but this logic we cannot be used in DTM. Along with this, on the 404 error page, the pageName variable should not be populated.
How this can be done, since I am fetching pageName from a data element in DTM (inside "Pageviews & Content" section) which would always fire on every page.
How to implement this, please help me out. Am I missing something ?
Thanks,
Adi
It sounds like your setup is like this:
<dtm header tag>
// code that identifies 404 page
<dtm footer tag>
And it sounds like the issue is that since data elements are the first thing evaluated up in DTM top tag, your page name data element is being evaluated before it is known that it is a 404 page.
What I would do is in the code that identifies that it is a 404 page, make it output a global js var that flags the page as a 404 page, e.g. window.is404Page=true;.
From here, the overall goal now is to keep your existing data element and pageName assignment as-is, but then later override it with an empty string (and pop pageType instead). You didn't really give any details about where you are actually setting pageName, so here are some scenarios that should point you in the right direction:
Scenario 1: pageName is set in Pageviews & Content in the main tool config
1.a: In Library Management, if you have set AA to load at Page Bottom, then go to Customize Page Code section, make sure it's set to execute "after UI Sttings" (If you are already using this code box and it must be set to execute before UI settings, then skip this and go to 1.b). Click on Open Editor and add the following:
if (window.is404Page) {
s.pageName='';
s.pageType='errorPage';
}
1.b: In Library Management, if you have set AA to load at Page Top, then you will need to create a page load rule (or use an existing rule that will trigger on every page view) that evaluates at page bottom, on dom ready, or onload (basically anything but top of page - point here is to get it to eval after is404Page has been set). Within the rule, go to Adobe Analytics > Custom Page Code and add the code from 1.a there.
Scenario 2: pageName is set within a page load rule
If your page load rule is set to trigger at "Top of Page" then you will need to create a separate rule that triggers after that. See 1.b.
2.a: If you are setting pageName from within the DTM field using %dataElement% syntax, then add the code from 1.a to the Custom Page Code section.
2.b: If you are setting pageName from within the Custom Page Code section, using e.g. s.pageName=_satellite.getVar('dataElement'); then simply add the code from 1.a directly below it.
TL;DR: set a global js var to act as a flag in your on-page code that determines if 404 page and then look for that in your DTM code to overwrite pageName and write pageType in DTM custom code sections that get eval'd after the js flag var is set.

Create link as we navigate inside menu bar?

we have requirement currently as shows in below image.
have googled much but i don't have specific key word so i couldn't find any thing.
we have a requirement to display link in navigation bar so user can select appropriate page without going forth and back ...by directly selecting the required page link.
how could it be possible to do inside asp.net as i have shows in image below.
Thank you so much........
You can have a look at Navigation here http://www.w3schools.com/aspnet/aspnet_navigation.asp and Site Map here http://msdn.microsoft.com/en-us/library/yy2ykkab.aspx
As basic as it can be, you can use a list on the pages where you want to show links.
Let's say you have three pages A, B and C. On each page add a list like below.
So you go about like this
<span>You are here</span>
<ul id="navList" runat="server">
</ul>
On page A's codebehind add the following to your list.
HyperLink nav=new HyperLink();
nav.NavigateUrl="A.aspx";//You can also pass parameters here.
HtmlGenericControl li=new HtmlGenericControl("<li>");
HtmlGenericControl span=new HtmlGenericControl("<span>");
span.InnerText=">>";
li.Controls.Add(span);
li.Controls.Add(nav);
navList.Controls.Add(li);
Similarly for B
HyperLink nav=new HyperLink();
nav.NavigateUrl="A.aspx";//You can also pass parameters here.
HtmlGenericControl li=new HtmlGenericControl("<li>");
HtmlGenericControl span=new HtmlGenericControl("<span>");
span.InnerText=">>";
li.Controls.Add(span);
li.Controls.Add(nav);
navList.Controls.Add(li);
HyperLink nav2=new HyperLink();
nav2.NavigateUrl="B.aspx";//You can also pass parameters here.
HtmlGenericControl li2=new HtmlGenericControl("<li>");
HtmlGenericControl span2=new HtmlGenericControl("<span>");
span2.InnerText=">>";
li2.Controls.Add(span);
li2.Controls.Add(nav);
navList.Controls.Add(li2);
And similarly for C.

how to go other page on dropdown selection using asp.net mvc

I have a dropdownlist box on my page.. with A B C D E F
each pages have different images.
Once If I select A I need display one Image like B I need to display other image/table on the page.
Can any one tel me how to do this?
I'd use jQuery, quick example to get you started:
$('#dropDownList').change(
function() {
$('#contentDiv').html("<img src='yourjpg.jpg' alt='alt text' />");
});
You will want to check some values and pick the correct jpg based on the value selected, but that should get you started.

Resources