CDataManage objdm = new CDataManage();
string sSql = "";
int page = 1;
string html = "";
DataTable dt = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
sSql = "select * from apps with(nolock) order by created desc";
dt = objdm.GetDataTableBySQL(sSql);
html = "";
if (Request["page"] != null && Request["page"].ToString() != "")
{
page = Convert.ToInt32(Request["page"].ToString());
}
//分页的页数
if (dt.Rows.Count > 0)
{
int pagenum = (dt.Rows.Count - 1) / 10 + 1;
if (page == 1)
{
html += "<a style="margin-right:15px;color:#888;text-decoration:none;">上一页</a>";
}
else
{
html += "<a href="CheckSift.aspx?page=" + (page - 1) + "" style="margin-right:15px;">上一页</a>";
}
html += "<select onchange="window.location=this.value;">";
for (int i = 0; i < pagenum; i++)
{
int a = i + 1;
if (page == a)
{
html += "<option selected="selected" value="CheckSift.aspx?page=" + a + "">" + a + "</option>";
}
else
{
html += "<option value="CheckSift.aspx?page=" + a + "">" + a + "</option>";
}
}
html += "</select>";
if (page == pagenum)
{
html += "<a style="margin-left:15px;color:#888;text-decoration:none;">下一页</a>";
}
else
{
html += "<a href="CheckSift.aspx?page=" + (page + 1) + "" style="margin-left:15px;">下一页</a>";
}
}
fenye.InnerHtml = html;
ShowMessage();
}
//分页显示信息
public void ShowMessage()
{
html = "";
if (dt.Rows.Count > 0)
{
string sift = "False";
string time = "";
int irank = (page - 1) * 10;
for (int i = 0; i < 10; i++)
{
if (irank < dt.Rows.Count)
{
sift = dt.Rows[irank]["issift"].ToString();
time = dt.Rows[irank]["created"].ToString();
html += "<li>";
html += "<input type='text' class='sift' value='" + dt.Rows[irank]["id"].ToString() + "' style='display:none;'>";
html += "<span class='title'>作品名称:" + dt.Rows[irank]["title"].ToString() + "</span><span class='line'></span>";
html += "<span class='creator'>发布人:" + dt.Rows[irank]["creator"].ToString() + "</span><span class='line'></span>";
html += "<span class='created'>发布时间:" + time.Substring(0, 10) + "</span><span class='line'></span>";
if (sift=="True") {
html += "<span>是否精选:<input disabled='disabled' checked='checked' type='checkbox' /></span>";
}
else {
html += "<span>是否精选:<input type='checkbox' onclick='IsSift(this)' /></span>";
}
html += "</li>";
}
irank++;
}
list.InnerHtml = html;
}
}