怎么把LABEL的值绑定到GRIDVIEW中
数据库里有一个字段是Member_ID(他是用户的ID),绑定到gridview 里是1,2,3,而我想要的是如果是admin发布的这个消息,则在gridview的发布人列里显示admin,而不是1,2,3,怎么实现这个阿?
string orderby = " ID desc ";
try
{
int Member_ID = Convert.ToInt32(Data_Member.ReturnMemeber_ID(Page.User.Identity.Name));
string Member = Data_Member.ReturnMember(Member_ID);//这已经得到了用户的名称
DataSet ds = Data_SystemNews.SystemNews_ByPage(whereclause, orderby, AspNetPager2.CurrentPageIndex, AspNetPager2.PageSize);
if (ds.Tables[0].Rows.Count > 0)
{
AspNetPager2.RecordCount = int.Parse(ds.Tables[0].Rows[0]["TotalCount"].ToString());
AspNetPager2.CustomInfoHTML = "共: " + ds.Tables[0].Rows[0]["TotalCount"].ToString() + "条记录!";
}
else
{
AspNetPager2.RecordCount = 0;
}
gv_Ad_News.DataSource = ds.Tables[0];
gv_Ad_News.DataBind();
}
catch (Exception ex)
{
JScript.Alert(ex.Message);
}
html代码
<ItemTemplate>
<div class="GV_frist_Row" style="width: 10%;">
<%# Eval("ID") %>
</div>
<div class="GV_frist_Row" style="width: 25%;">
<%# Eval("Ttitle")%>
</div>
<div class="GV_frist_Row" style="width: 15%;">
//在这怎么把得到的名称绑定过来啊?div>
<div class="GV_frist_Row" style="width: 10%;">
<asp:LinkButton ID="but_OnTop" runat="server" CommandName="OnTop"><%# ReturnOntop(Eval("OnTop").ToString())%></asp:LinkButton>
</div>
<div class="GV_frist_Row" style="width: 10%;">
<asp:LinkButton ID="but_Commend" runat="server" CommandName="Commend"><%# ReturnCommend(Eval("Commend").ToString()) %></asp:LinkButton>
</div>
<div class="GV_frist_Row" style="width: 10%;">
<asp:LinkButton ID="but_state" runat="server" CommandName="state"><%# Returnstate(Eval("state").ToString()) %></asp:LinkButton>
</div>
<div class="GV_frist_Row" style="width: 10%;">
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/ic_delartc.gif"
CommandName="Delete" /></div>
<div class="GV_frist_Row" style="width: 9.8%;">
<a href="SystemNews_Insert.aspx?ID=<%# Eval("ID")%>">
<img border="0" src="../images/ic_edit.gif" /></a>
</div>
</ItemTemplate>