首页 新闻 会员 周边

GridView 控件设计留言板 知道的进

0
悬赏园豆:5 [已解决问题] 解决于 2009-04-24 19:35

我要做一个留言板的习题 用GirdVieW 控件做一个留言板显示页  可是我不会 那个指教一下

真的不难的主页 真的不难 | 初学一级 | 园豆:130
提问于:2009-04-19 21:46
< >
分享
最佳答案
0

这个地方用Gridview 或许不太合适

用repeater和datalist应该更加容易控制    没法发图上来

就把html贴出来吧   可能对你有些帮助

 

 

   <asp:DataList ID="DataList1" runat="server" OnItemDataBound="DataList1_ItemDataBound"
        Style="position: relative" Width="100%">
        <SeparatorTemplate>
            <br />
        </SeparatorTemplate>
        <ItemTemplate>
            <table border="0" cellpadding="0" cellspacing="0" style="border-top: #e8e8e8 1px solid;
                left: 1px; width: 996px; position: relative; top: 0px; height: 32px">
                <tr>
                    <td align="center" style="background-image: url(images/showbj.gif); border-left: #e8e8e8 1px solid;
                        width: 21px; height: 27px">
                        <img alt="a" src="../Images/GBook/001.gif" style="position: relative" /></td>
                    <td align="right" background="../Images/GBook/showbj.gif" colspan="2" style="border-right: #e8e8e8 1px solid;
                        background-image: url(images/showbj.gif); width: 978px; height: 27px; ">
                        <div style="left: 2px; width: 350px; position: relative; top: 0px; height: 26px;
                            text-align: left">
                            <a href='mailto:<%#DataBinder.Eval(Container.DataItem,"name") %>'>
                                <img id="IMG1" alt="a" src="../Images/GBook/mail.gif" style="left: 0px; border-top-style: none;
                                    border-right-style: none; border-left-style: none; position: relative; top: 3px;
                                    border-bottom-style: none" /></a> Email &nbsp; <a href='<%#DataBinder.Eval(Container.DataItem,"name") %>'>
                                        <img alt="a" src="../Images/GBook/qq.gif" style="border-top-style: none; border-right-style: none;
                                            border-left-style: none; position: relative; top: 3px; border-bottom-style: none" /></a>
                            QQ &nbsp;<a href='<%#DataBinder.Eval(Container.DataItem,"name") %>'><img alt="a" src="../Images/GBook/home.gif"
                                style="border-top-style: none; border-right-style: none; border-left-style: none;
                                position: relative; top: 3px; border-bottom-style: none" /></a> 主页 &nbsp;<img alt="a"
                                    src="../Images/GBook/posttime.gif" style="left: 0px; border-top-style: none;
                                    border-right-style: none; border-left-style: none; position: relative; top: 3px;
                                    border-bottom-style: none" />
                            发布时间:<%#DataBinder.Eval(Container.DataItem, "time", "{0:D}")%></div>
                    </td>
                </tr>
            </table>
            <table border="0" cellpadding="0" cellspacing="0" style="border-right: #e8e8e8 1px solid;
                left: 1px; border-left: #e8e8e8 1px solid; width: 996px; position: relative;
                top: 0px; height: 100%">
                <tr>
                    <td align="center" style="border-right: #e8e8e8 1px solid; width: 125px; height: 123px">
                        <div style="width: 100px; position: relative; height: 100px">
                            <%--<img alt="a" src='images/face/<%#DataBinder.Eval(Container.DataItem,"name")%>'--%>
                              <img alt="a" src="../Images/GBook/pic1.gif" />
                                </div>
                        <asp:Label ID="lblUserPic" runat="server" Style="position: relative" Text='<%#DataBinder.Eval(Container.DataItem,"name") %>'></asp:Label></td>
                    <td style="width: 431px; border-bottom: #e8e8e8 1px solid; height: 123px">
                        <div style="left: 3px; width: 855px; position: relative; top: 0px; height: 82px;
                            text-align: left; ">
                            <%#DataBinder.Eval(Container.DataItem, "content")%>
                            <br />
                            ——————————————————<br />
                          <div style=" color: red;"> 管理员回复:<%#DataBinder.Eval(Container.DataItem, "repcontent")%><br />
                            <%#DataBinder.Eval(Container.DataItem, "reptime")%></div>
                        </div>
                        <div style="left: 2px; width: 852px; position: relative; top: 0px; height: 25px;
                            text-align: right">
                            <img src="../Images/GBook/reply.gif" style="position: relative; top: 2px" />
                            <a href="AddGBook.aspx" target="_blank">发表留言</a>
                            <img src="../Images/GBook/004.gif" style="position: relative; top: 2px" />
                            <asp:LinkButton ID="lbtnReply" runat="server" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>'
                                OnCommand="lbtnReply_Command" Style="position: relative; top: 0px">回复</asp:LinkButton>
                            <img alt="a" src="../Images/GBook/delete.gif" style="border-top-style: none; border-right-style: none;
                                border-left-style: none; position: relative; top: 5px; border-bottom-style: none" />
                            <asp:LinkButton ID="lbtnDelete" runat="server" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>'
                                OnCommand="lbtnDelete_Command" Style="position: relative">删除</asp:LinkButton>&nbsp;
                        </div>
                    </td>
                </tr>
            </table>
            <table border="0" cellspacing="0" style="border-top: #e8e8e8 1px solid; left: 1px;
                width: 996px; position: relative; top: 0px; height: 13px">
                <tr>
                    <td style="background-image: url(images/showbj.gif); border-left: #e8e8e8 1px solid;
                        width: 114px; height: 17px">
                        <img alt="a" src="../Images/GBook/003.gif" style="position: relative" /></td>
                    <td style="background-image: url(images/showbj.gif); width: 2172px; height: 17px">
                    </td>
                    <td align="right" style="border-right: #e8e8e8 1px solid; background-image: url(images/showbj.gif);
                        width: 133px; height: 17px">
                        <img alt="a" src="../Images/GBook/001.gif" style="position: relative" /></td>
                </tr>
            </table>
        </ItemTemplate>
    </asp:DataList>

随心飘 | 菜鸟二级 |园豆:250 | 2009-04-20 08:34
其他回答(3)
0

你用GridView吗?这中模式的应该使用repertor控件吧?或者DataList啊!

雪莱·亨尼格 | 园豆:524 (小虾三级) | 2009-04-19 23:45
0

同意,用DATALIST可以。

SEA虎 | 园豆:220 (菜鸟二级) | 2009-04-20 09:01
不知道博客园的这个留言本怎么作的。爱!!!
支持(0) 反对(0) 宁静致远2 | 园豆:200 (初学一级) | 2010-03-03 14:18
0

2楼的太强了,我就不竞争了,呵呵!你先试试吧!不行了我再说我的方法!

子夜星辰 | 园豆:1613 (小虾三级) | 2009-04-20 09:04
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册