I am using ASP.NET repeater function. Its working fine. But here all the comments are coming one by one without any separation. I need each comment to be placed in a separate box and to add back ground color to that box. Just like in wordpress comment page how the comments are separated. My complete code follows please tell me how to separate each comment.
comments.aspx
<html>
<body>
<form id="form1" runat="server">
<asp:Repeater id="Repeater1" runat="server" >
<HeaderTemplate>
<table border=1>
</HeaderTemplate>
<ItemTemplate>
<tr>
<%# DataBinder.Eval(Container.DataItem, "Name") %> </br>
<%# DataBinder.Eval(Container.DataItem, "Val4") %> </br></br></br>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<br />
<br />
Name*:
<asp:TextBox ID="tb_name" runat="server" placeholder="Your Name"></asp:TextBox>
<br />
<br />
Email*:
<asp:TextBox ID="tb_email" runat="server"></asp:TextBox>
<br />
<br />
Website :
<asp:TextBox ID="tb_website" runat="server"></asp:TextBox>
<br />
<br />
<asp:TextBox ID="tb_comment" runat="server" Height="114px" TextMode="MultiLine"
Width="322px"></asp:TextBox>
<br />
<br />
<br />
<asp:CheckBox ID="cb_notify" runat="server"
Text="Notify me of followup comments via e-mail." />
<br />
<br />
<br />
<asp:Button ID="Submit" runat="server" onclick="Submit_Click"
Text="Post Comment" />
</form>
</body>
</html>
comments.aspx.cs
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Odbc;
using System.Collections;
public partial class comment : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" + "SERVER=localhost;" + "DATABASE=softmail;" + "UID=root;" + "PASSWORD=********;" + "OPTION=3";
OdbcConnection MyConnection = new OdbcConnection(MyConString);
MyConnection.Open();
OdbcCommand cmd = new OdbcCommand("Select name, email, website, comments from awm_comments", MyConnection);
OdbcDataReader dr = cmd.ExecuteReader();
if (dr.HasRows == false)
{
throw new Exception();
}
ArrayList values = new ArrayList();
while (dr.Read())
{
if (!IsPostBack)
{
string a = dr[0].ToString();
string b = dr[1].ToString();
string c = dr[2].ToString();
string d = dr[3].ToString();
values.Add(new PositionData(a, b, c, d));
Repeater1.DataSource = values;
Repeater1.DataBind();
}
}
}
protected void Submit_Click(object sender, EventArgs e)
{
string name = tb_name.Text;
string email = tb_email.Text;
string website = tb_website.Text;
string comment = tb_comment.Text;
string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" + "SERVER=localhost;" + "DATABASE=softmail;" + "UID=root;" + "PASSWORD=******;" + "OPTION=3";
OdbcConnection MyConnection = new OdbcConnection(MyConString);
OdbcCommand cmd = new OdbcCommand("INSERT INTO awm_comments(name, email, website, comments, notify)VALUES(?, ?, ?, ?, ?)", MyConnection);
cmd.Parameters.Add("@email", OdbcType.VarChar, 255).Value = name;
cmd.Parameters.Add("@alternate_email", OdbcType.VarChar, 255).Value = email;
cmd.Parameters.Add("@ipaddr", OdbcType.VarChar, 255).Value = website;
cmd.Parameters.Add("@security_question", OdbcType.VarChar, 255).Value = comment;
if (cb_notify.Checked == true)
{
int not = 1;
cmd.Parameters.Add("@security_question", OdbcType.Int, 11).Value = not;
}
else if (cb_notify.Checked == false)
{
int not = 0;
cmd.Parameters.Add("@security_question", OdbcType.Int, 11).Value = not;
}
MyConnection.Open();
cmd.ExecuteNonQuery();
MyConnection.Close();
Response.Redirect("comment.aspx");
}
public class PositionData
{
private string name;
private string ticker;
private string val3;
private string val4;
public PositionData(string name, string ticker, string val3, string val4)
{
this.name = name;
this.ticker = ticker;
this.val3 = val3;
this.val4 = val4;
}
public string Name
{
get
{
return name;
}
}
public string Ticker
{
get
{
return ticker;
}
}
public string Val3
{
get
{
return val3;
}
}
public string Val4
{
get
{
return val4;
}
}
}
}
Output

I would make such a thing like this
With this approach you can leave Footer and Header tempaltes.
Style div as you like.