-
Notifications
You must be signed in to change notification settings - Fork 0
/
partnere.aspx.cs
62 lines (52 loc) · 2.61 KB
/
partnere.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class om_os : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int pageId = 3;
List<page> pages = (List<page>)Session["pages"];
page page = pages[pageId];
string query = HttpContext.Current.Request.Url.AbsolutePath;
string sub = Regex.Match(query, "/" + Regex.Replace(page._name, @"\s", "-") + @".aspx/[\w\d\-]+", RegexOptions.IgnoreCase).ToString();
if (sub != "")
{
subpage subpage = new subpage();
subpage = page._subpages[subpage.getSubpageId(query, page._subpages)];
displaySubPage(subpage, page._name);
}
else
{
displayPage(page);
}
}
public void displayPage(page page)
{
litBreadcrumb.Text = "<bread-crumb type='first'><a href='/default.aspx'>Hjem</a></bread-crumb><bread-crumb type='last'><a href='/" + Regex.Replace(page._name, @"\s", "-").ToLower() + ".aspx'>" + page._name + "</a></bread-crumb>";
litPagename.Text = page._name;
litSubpages.Text = "";
foreach (subpage subpage in page._subpages)
{
litSubpages.Text += "<li><a href='/" + Regex.Replace(page._name, @"\s", "-").ToLower() + ".aspx/" + Regex.Replace(subpage._name, @"\s", "-").ToLower() + "'>" + subpage._name + "</a>";
// get subpage subpages
litSubpages.Text += "</li>";
}
litContent.Text = page._content;
}
public void displaySubPage(subpage subpage, string pageName)
{
litBreadcrumb.Text = "<bread-crumb type='first'><a href='/hjem'>Hjem</a></bread-crumb><bread-crumb><a href='/" + Regex.Replace(pageName, @"\s", "-").ToLower() + ".aspx'>" + pageName + "</a></bread-crumb><bread-crumb type='last'><a href='/" + Regex.Replace(pageName, @"\s", "-").ToLower() + ".aspx/" + Regex.Replace(subpage._name, @"\s", "-").ToLower() + "'>" + subpage._name + "</a></bread-crumb>";
litPagename.Text = subpage._name;
litSubpages.Text = "";
foreach (subpage subsubpage in subpage._subpages)
{
litSubpages.Text += "<li><a href='/" + Regex.Replace(pageName, @"\s", "-").ToLower() + ".aspx/" + Regex.Replace(subsubpage._name, @"\s", "-").ToLower() + "/" + Regex.Replace(subsubpage._name, @"\s", "-").ToLower() + "'>" + subsubpage._name + "</a></li>";
}
litContent.Text = subpage._content;
}
}