-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMasterPage.master.cs
More file actions
38 lines (34 loc) · 1 KB
/
Copy pathMasterPage.master.cs
File metadata and controls
38 lines (34 loc) · 1 KB
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
using System;
using System.Collections.Generic;
public partial class MasterPage : System.Web.UI.MasterPage
{
public bool isUserLoggedIn = false;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DisplayNavigationMenu();
isUserLoggedIn = Session["LoggedInuser"] != null;
}
}
void DisplayNavigationMenu()
{
List<Category> Categories = Category.GetAll();
string html = listNavigation.InnerHtml;
if (Categories.Count == 0)
return;
foreach (var cat in Categories)
{
html += "<li><a href = 'Category.aspx?id=" + cat.Id + "'>" + cat.Name + "</a></li>";
}
listNavigation.InnerHtml = html;
}
protected void btnSearch_Click(object sender, EventArgs e)
{
string keywords = "";
keywords = txtSearch.Text;
if (keywords == "")
return;
Response.Redirect("Search.aspx?terms=" + keywords);
}
}