日期:2014-05-18  浏览次数:20360 次

datalist 实现评论 回复
datalist 怎么实现评论的功能? 

我现在用一个datalist实现新闻的详细内容,html 与CS的代码如下,想实现每个新闻有评论,并在同一个页面显示!!

问题1、怎样在datalist中实现回复框?

问题2、怎样显示在同一页面



HTML code
 
        <asp:DataList ID="DataList1" runat="server">
              <ItemTemplate> 
  <table border=1> 
  <tr> 
<td>ID: <%#  DataBinder.Eval(Container.DataItem,  "ID")  %> <td>
<tr>
    <td>
        用户ID: <%#  DataBinder.Eval(Container.DataItem,  "userid")  %>
        <td>
            <tr>
                <td>
                    标题: <%#  DataBinder.Eval(Container.DataItem,  "title")  %> </td>
            </tr>
            <tr>
                <td>
                    内容: <%#  DataBinder.Eval(Container.DataItem,  "content")  %>
                </td>
            </tr>
            <tr>
                <td>
                    bb: <%#  DataBinder.Eval(Container.DataItem,  "bb")  %>
                </td>
            </tr>
            <tr>
                <td>
                    aaa: <%#  DataBinder.Eval(Container.DataItem,  "aaa")  %>
                </td>
            </tr>

  </table> 
  </ItemTemplate>


[code=C#]




  if (Request.QueryString["ID"] != null)
  {
  SqlConnection conn = db.creatdb();

  string tosuID = Request.QueryString["ID"].ToString();

  SqlDataAdapter sda = new SqlDataAdapter();
  sda.SelectCommand = new SqlCommand("select * from feedback where ID=+'" + ID + "'", conn);
  DataTable dt = new DataTable();
  sda.Fill(dt);
  DataList1.DataSource = dt.DefaultView;
  DataList1.DataBind();

  }

[/code]

------解决方案--------------------

<ItemTemplate>
<TABLE id="Table2" cellSpacing="4" cellPadding="0" border="0" style="FONT-SIZE: 9pt">
<TR>
<TD><br>
回复人:<%# DataBinder.Eval(Container, "")%>
回复时间:<%# DataBinder.Eval(Container, "")%>
 </TD>
</TR>
<TR>