读书人

.net 论坛已经制定的帖子如何显示一个

发布时间: 2012-12-20 09:53:21 作者: rapoo

.net 论坛已经制定的帖子怎么显示一个div“顶” 100分

<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>


[最优解释]
ok 解决了 谢谢大哥
[其他解释]
<% if (...)
{ %>
<div><span>顶</span></div>
<% } %>
[其他解释]
就是if里面不知道怎么写
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()
{

}






}
}


[其他解释]
1:
<% if(有数据)
{%>
<span><%#Eval("ding")%></span>
<%}
else
%>
2:
<%# Eval("zhidingid").ToString() == "1" ? "顶" : "" %>
3:
<%if (Eval("zhidingid").ToString() == "1")
{%>
<span><%#Eval("ding")%></span>
<%}
else
{%>
//不知道了
<%}
%>
[其他解释]
null

读书人网 >asp.net

热点推荐