| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2946 人关注过本帖
标题:怎么把LABEL的值绑定到GRIDVIEW中
取消只看楼主 加入收藏
lmyh5201
Rank: 1
等 级:新手上路
帖 子:241
专家分:0
注 册:2007-3-29
结帖率:100%
收藏
 问题点数:0 回复次数:7 
怎么把LABEL的值绑定到GRIDVIEW中
数据库里有一个字段是Member_ID(他是用户的ID),绑定到gridview 里是1,2,3,而我想要的是如果是admin发布的这个消息,则在gridview的发布人列里显示admin,而不是1,2,3,怎么实现这个阿?
搜索更多相关主题的帖子: LABEL 绑定 GRIDVIEW 
2008-10-06 14:21
lmyh5201
Rank: 1
等 级:新手上路
帖 子:241
专家分:0
注 册:2007-3-29
收藏
得分:0 
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>

2008-10-06 14:31
lmyh5201
Rank: 1
等 级:新手上路
帖 子:241
专家分:0
注 册:2007-3-29
收藏
得分:0 
回复 2# 仰望星空 的帖子
代码怎么写啊?谢谢

2008-10-06 14:41
lmyh5201
Rank: 1
等 级:新手上路
帖 子:241
专家分:0
注 册:2007-3-29
收藏
得分:0 
具体点阿

2008-10-06 18:10
lmyh5201
Rank: 1
等 级:新手上路
帖 子:241
专家分:0
注 册:2007-3-29
收藏
得分:0 
给点代码侃侃啊

2008-10-06 20:34
lmyh5201
Rank: 1
等 级:新手上路
帖 子:241
专家分:0
注 册:2007-3-29
收藏
得分:0 
怎么处理dataset里面的东西啊

2008-10-06 20:45
lmyh5201
Rank: 1
等 级:新手上路
帖 子:241
专家分:0
注 册:2007-3-29
收藏
得分:0 
还是不明白

2008-10-06 20:56
lmyh5201
Rank: 1
等 级:新手上路
帖 子:241
专家分:0
注 册:2007-3-29
收藏
得分:0 
绑定之前,总能得到一个dataset之类的东东吧,把这个dataset之类的东东处理一下,再绑定不就好了?

怎么处理啊

2008-10-06 21:12
快速回复:怎么把LABEL的值绑定到GRIDVIEW中
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017298 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved