我希望在我的转发器控件中的每三个项目之后休息一下。我怎么能这样做?
<asp:Repeater ID="rptrExample" runat="server">
<ItemTemplate>
<td width="550px">
<p>E <%# DataBinder.Eval(Container, "DataItem.price") %></p>
<img alt='<%# DataBinder.Eval(Container, "DataItem.title") %>' src='<%# DataBinder.Eval(Container, "DataItem.url") %>' width="184px" height="140px" style="border-color: #0d6e74; border: 1px" />
</td>
</ItemTemplate>
</asp:Repeater>
代码隐藏:
public void LoadJewels()
{
OdbcConnection conn;
string requestbron = Request.QueryString["bron"];
requestbron = requestbron != null ? requestbron : "1";
conn = new OdbcConnection(ConfigurationManager.ConnectionStrings["jewelsConnectionString"].ConnectionString);
conn.Open();
string sql = "SELECT price, url FROM item AS a LEFT JOIN picture AS b ON a.iid = b.iid WHERE cid =" + Convert.ToInt32(requestbron) + " AND bigpicture =1";
OdbcCommand cmd = new OdbcCommand(sql, conn);
try
{
rptrExample.DataSource = cmd.ExecuteReader();
rptrExample.DataBind();
cmd.Connection.Close();
cmd.Connection.Dispose();
}
catch (Exception ex)
{
lblStatus.Text = ex.Message;
}
}
答案 0 :(得分:4)
<br runat="server" Visible="<%# (Container.ItemIndex % 3) == 2 %>" />