2个回答
展开全部
用Repeater来控制哇
<asp:Repeater ID="rpttestp" runat="server" Visible="false"
onitemcommand="rpttestp_ItemCommand">
<HeaderTemplate>
<table border="0" align="center">
<tr>
</HeaderTemplate>
<ItemTemplate>
<td style="height:240px; width: 240px;" align="center">
<asp:Image ID="imgName" runat="server" ImageUrl="~/img/wenjian.jpg" />
<br />
<h3><a href="ManagerSelect.aspx?typeId=<%#Eval("typeid")%>"><%#Eval("typeGName")%></a></h3>
</td>
</ItemTemplate>
<FooterTemplate>
</tr></table>
</FooterTemplate>
</asp:Repeater>
后台
this.rpttestp.DataSource = ListddlTestSelect(typeid);
this.rpttestp.DataBind();
protected void rpttestp_ItemCommand(object source, RepeaterCommandEventArgs e)
{
int i = e.Item.ItemIndex + 1;
if (i % 2 == 0)
{
e.Item.Controls.Add(new LiteralControl("</tr><tr>"));
}
i++;
}
<asp:Repeater ID="rpttestp" runat="server" Visible="false"
onitemcommand="rpttestp_ItemCommand">
<HeaderTemplate>
<table border="0" align="center">
<tr>
</HeaderTemplate>
<ItemTemplate>
<td style="height:240px; width: 240px;" align="center">
<asp:Image ID="imgName" runat="server" ImageUrl="~/img/wenjian.jpg" />
<br />
<h3><a href="ManagerSelect.aspx?typeId=<%#Eval("typeid")%>"><%#Eval("typeGName")%></a></h3>
</td>
</ItemTemplate>
<FooterTemplate>
</tr></table>
</FooterTemplate>
</asp:Repeater>
后台
this.rpttestp.DataSource = ListddlTestSelect(typeid);
this.rpttestp.DataBind();
protected void rpttestp_ItemCommand(object source, RepeaterCommandEventArgs e)
{
int i = e.Item.ItemIndex + 1;
if (i % 2 == 0)
{
e.Item.Controls.Add(new LiteralControl("</tr><tr>"));
}
i++;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询