<table id="table1" style="width:100%;padding-top:0px; height:50px; text-align:center; ">
<tr>
<td style="width:100px;padding-top:0px;text-align:center;" >
<tt>
<%# GetReplyCount(Convert.ToInt32(Eval("T_id").ToString()))%>
</tt>
<tt>
</tt>
</td>
<td style="width:600px;text-align:left;padding-top:0px;"><a href='<%# Eval("T_id","TopicReply.aspx?id={0}") %>' target="_blank"> <%# Eval("T_title")%></a></td>
<td style="width:100px;padding-top:0px;">
<tt style="width:250px;">
<a href="#" target="_blank"><%# GetEditer( Convert.ToInt32( Eval("U_id")))%></a>
</tt>
<br />
<tt style="text-align:center">
<%# GetLastReplyAuthor(Eval("T_id").ToString())%>
</tt>
</td>
<td style=" width:80px;">
<div id="istopclass">
<% if() %><%--这里显示顶--%>
</div>
</td>
<td>
<div id="admin">管理
<div id="admins">
<asp:LinkButton ID="LinkBtn_delete" CommandArgument='<%#Eval("T_id") %>' runat="server" CommandName="1">删除</asp:LinkButton><br />
<asp:LinkButton ID="LinkBtn_top" CommandArgument='<%#Eval("T_id") %>' runat="server" CommandName="2">置顶</asp:LinkButton><br />
<asp:LinkButton ID="LinkBtn_un_top" CommandArgument='<%#Eval("T_id") %>' runat="server" CommandName="3">取消置顶</asp:LinkButton>
</div>
</div>
</td>
</tr>
</table>
<tr>
<td style="width:100px;padding-top:0px;text-align:center;" >
<tt>
<%# GetReplyCount(Convert.ToInt32(Eval("T_id").ToString()))%>
</tt>
<tt>
</tt>
</td>
<td style="width:600px;text-align:left;padding-top:0px;"><a href='<%# Eval("T_id","TopicReply.aspx?id={0}") %>' target="_blank"> <%# Eval("T_title")%></a></td>
<td style="width:100px;padding-top:0px;">
<tt style="width:250px;">
<a href="#" target="_blank"><%# GetEditer( Convert.ToInt32( Eval("U_id")))%></a>
</tt>
<br />
<tt style="text-align:center">
<%# GetLastReplyAuthor(Eval("T_id").ToString())%>
</tt>
</td>
<td style=" width:80px;">
<div id="istopclass">
<% if() %><%--这里显示顶--%>
</div>
</td>
<td>
<div id="admin">管理
<div id="admins">
<asp:LinkButton ID="LinkBtn_delete" CommandArgument='<%#Eval("T_id") %>' runat="server" CommandName="1">删除</asp:LinkButton><br />
<asp:LinkButton ID="LinkBtn_top" CommandArgument='<%#Eval("T_id") %>' runat="server" CommandName="2">置顶</asp:LinkButton><br />
<asp:LinkButton ID="LinkBtn_un_top" CommandArgument='<%#Eval("T_id") %>' runat="server" CommandName="3">取消置顶</asp:LinkButton>
</div>
</div>
</td>
</tr>
</table>
解决方案 »
- ASP.NET的一个警告
- Ajax给力送分 ScriptManager与UpdatePanel这样设置为什么事件不执行.
- 怎么做那种类似博客更换模板的那种效果?
- C# gif动画生成处理
- 正则表达式的问题!
- 如何通过互联网向用户的手机发短信呢?在线ing……………………
- 急啊,在线等,请各位帮帮忙啊!
- 系统登录问题,只允许一个人登录,200分
- 如何利用System.Drawing画表格!!谁有源代码?
- asp.net如何使用FreeTextBox输出word文档的内容
- 重新开贴 RegisterStartupScript中的alert 弹出框无效
- 遇到一个数据库的经典查询,求大虾帮忙,第一次发帖!
{ %>
<div><span>顶</span></div>
<% } %>
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using xhforum.bll;
using xhforum.dal;
using xhforum.model;namespace xhforum.page
{ public partial class TopicList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
PageUp();
}
} //private void Bind()
//{ // string id = Request.QueryString["id"];
// this.Repeater1.DataSource = new SubjectManager().getAllSubject(id);
// this.DataBind();
//}
/// <summary>
/// 存储过程分页
/// </summary>
private void PageUp()
{
string id = Request.QueryString["id"];
string strWhere = "s_id=" + id; int count = new TopicManager().GetpageCount(strWhere);
this.AspNetPager1.RecordCount = count;//count/this.AspNetPager1.PageSize;
this.AspNetPager1.AlwaysShow = true;
int pageSize = AspNetPager1.PageSize;
int pageIndex = AspNetPager1.CurrentPageIndex;
this.Repeater1.DataSource = new TopicManager().getPage(pageSize, pageIndex, strWhere, 0);
this.Repeater1.DataBind();
this.Repeater2.DataSource = new SubjectManager().getSubjectByWhere(id,"4");
this.DataBind();
}
protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{
AspNetPager1.CurrentPageIndex = e.NewPageIndex;
PageUp();
}
protected void BtnInsert_Click(object sender, ImageClickEventArgs e)
{ if (Session["username"] == null)
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('您还没有登录,请先登录!');</script>"); }
else
{
if (TxtTitle.Text == "")
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('标题不能为空!');</script>");
}
else if (TxtTitle.Text.Length > 30)
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('输入指数不能超过30!');</script>");
}
else
{ string name = Session["username"].ToString();
DateTime time = DateTime.Now; string id = Request.QueryString["id"];
Topic tic = new Topic();
tic.T_id = (new TopicManager().getMaxId()).T_id;
tic.S_id = Convert.ToInt32(id);
tic.U_id = (new UserManager().getUserByName(name)).U_id;
tic.T_title = TxtTitle.Text;
tic.T_IsDistribute = false;
tic.T_isTop = false;
tic.T_readCount = 1;
tic.T_recommend = false;
tic.T_content = TxtContent.Text;
tic.T_time = time;
bool resoult = new TopicManager().addTopic(tic);
if (resoult)
{
PageUp();
}
}
}
this.TxtTitle.Text = "";
this.TxtContent.Text = ""; }
public long GetReplyCount(int id)
{ return new ReplyManager().getReplysByWhere(id.ToString(), "1").Count;
}
public string GetEditer(int id)
{ return new UserManager().getUserById(id.ToString()).U_name;
}
public string GetLastReplyTime(string id)
{
return new ReplyManager().GetLastReplyTime(id); }
public string GetLastReplyAuthor(string id)
{
return new ReplyManager().GetLastReplyAuthor(id);
}
/// <summary>
/// 删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{ if (e.CommandName == "1")
{
int id = Convert.ToInt32(e.CommandArgument);
bool resoult = new TopicManager().deleteTopic(id);
if (resoult)
{
PageUp();
} }
if (e.CommandName == "2")
{
int id = Convert.ToInt32(e.CommandArgument);
bool istop =true;
bool resoult = new TopicManager().SetTop(id,istop);
if (resoult)
{
PageUp();
}
}
if (e.CommandName == "3")
{
int id = Convert.ToInt32(e.CommandArgument);
bool istop = false;
bool resoult = new TopicManager().SetTop(id, istop);
if (resoult)
{
PageUp(); }
}
//置顶
//int tid = Convert.ToInt32(e.CommandArgument);
//bool top = (new TopicManager().getTopicByid(tid)).T_isTop;
//if (top)
//{
// this.Visible = true;
//}
//else
//{
// this.Visible = false;
//}
}
private void istop()
{
}
}
}
<% if(有数据)
{%>
<span><%#Eval("ding")%></span>
<%}
else
%>
2:
<%# Eval("zhidingid").ToString() == "1" ? "顶" : "" %>
3:
<%if (Eval("zhidingid").ToString() == "1")
{%>
<span><%#Eval("ding")%></span>
<%}
else
{%>
//不知道了
<%}
%>