-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCategory.aspx.cs
More file actions
77 lines (70 loc) · 2.16 KB
/
Copy pathCategory.aspx.cs
File metadata and controls
77 lines (70 loc) · 2.16 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default2 : System.Web.UI.Page
{
Category cat;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetCategory();
DisplayCategory();
}
}
private void DisplayCategory()
{
if (cat == null)
GetCategory();
lblCategoryTitle.InnerText = cat.Name;
List<Listings> items = cat.GetAllListings();
if (items.Count == 0)
{
lblRecentListingContainer.Text = "No items found";
return;
}
string html = "";
foreach(var item in items)
{
html += @"
<div class='col-md-3 gallery-grid '>
<a href = 'single.aspx?id=" + item.Id + @"'>
<img src = 'data/" + item.ImageUrl + @"' class='img-responsive'/>
<div class='gallery-info'>
<div class='quick'>
<p><span class='glyphicon glyphicon-eye-open' aria-hidden='true'></span>view</p>
</div>
</div>
</a>
<div class='galy-info'>
<p>" + item.Title + @"</p>
<div class='galry'>
<div class='prices'>
<h5 class='item_price'>£ " + item.Price + @"</h5>
</div>
<div class='clearfix'></div>
</div>
</div>
</div>
";
}
lblRecentListingContainer.Text = html;
}
private void GetCategory()
{
if (Request.QueryString["id"] == null)
{
Response.Redirect("Default.aspx");
return;
}
var _id = Request.QueryString["id"].ToString();
int id;
int.TryParse(_id, out id);
cat = new Category();
cat.Id = id;
cat.Get();
}
}