-
Notifications
You must be signed in to change notification settings - Fork 0
/
newscate.aspx.cs
64 lines (61 loc) · 2.05 KB
/
newscate.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
63
64
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
public partial class catenews : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int c = Convert.ToInt32(Request.QueryString["uid"]);
string str = "select count(*) from news where _cateid="+c+"";
int result = Convert.ToInt32(Common.DB.ExecuteScalar(str));
AspNetPager1.RecordCount = result;
AspNetPager1.PageSize = 20;
info();
repeat();
}
}
public void info()
{
int c = Convert.ToInt32(Request.QueryString["uid"]);
string str = "select * from news,article where news._ispic=article._id and news._cateid=" + c + " order by _top desc ,news._id desc ";
string sql = "select * from newscate where _cateid=" + c + "";
SqlDataReader sdr = Common.DB.dataReader(sql);
if (sdr.Read())
{
Page.Title = sdr["_catename"].ToString();
}
sdr.Close();
DataSet ds = Common.DB.PagedataSet(str, AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "helpcate");
Repeater1.DataSource = ds.Tables[0];
Repeater1.DataBind();
}
protected void AspNetPager1_PageChanging1(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{
AspNetPager1.CurrentPageIndex = e.NewPageIndex;
info();
}
protected void Button1_Click1(object sender, EventArgs e)
{
if (search.Text != "")
{
Response.Redirect("newselect.aspx?title=" + search.Text + "");
}
}
private void repeat()
{
string st = "select * from newscate ";
DataSet ds1 = Common.DB.dataSet(st);
Repeater2.DataSource = ds1.Tables[0];
Repeater2.DataBind();
}
}