Repeater 列数

nply2008 2009-08-01 11:18:06
<ItemTemplate>
<table width="99%" height="18" border="0" align="center" cellpadding="0" cellspacing="0"
style="margin-top: 8px">
<tr>
<td align="center">
<table width="152" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="152" colspan="2" style="border: #CCCCCC 1px solid">
<img src="Admin/Shop/<%# Eval("ImageUrl") %>" width="150" height="191" /></td>
</tr>
<tr>
<td height="20" colspan="2" align="center">
<%# Eval("ProductName").ToString().Substring(0, 10)%></td>
</tr>
<tr>
<td height="19" colspan="2" align="center">
<span class="STYLE2">尺码:M L </span>
</td>
</tr>
<tr>
<td height="19" colspan="2" align="center">
市场价: ¥<%# string.Format("{0:f2}",Eval("CCPrice"))%></td>
</tr>
<tr>
<td height="19" colspan="2" align="center">
会员价: ¥<%# string.Format("{0:f2}",Eval("HYPrice"))%></td>
</tr>
<tr>
<td height="31" align="center">
<a href="gwc.aspx"><img src="images/w3.jpg" width="70" height="31" border="0" /></a></td>
<td>
<a href='scj.aspx?productName=<%# Eval("ProductName")%>&edit=1'><img height="31" src="images/w4.jpg" width="70" border="0" /></a></td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>

原代码:
string sql = "select * from IShop_Product";
Repeater1.DataSource = sqlHelper.getMyDataSet(sql);
Repeater1.DataBind();

我要显示的格式是:
a b c d e
e f g h j
就是要显示5列?
要怎么设置列数?
...全文
111 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
weiqj8686 2009-11-26
  • 打赏
  • 举报
回复
这个问题不错,不错呀
runit 2009-08-01
  • 打赏
  • 举报
回复
<ItemTemplate>
<table width="99%" height="18" border="0" align="center" cellpadding="0" cellspacing="0"
style="margin-top: 8px">
<tr>
<td align="center">
<table width="152" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="152" colspan="2" style="border: #CCCCCC 1px solid">
<img src="Admin/Shop/ <%# Eval("ImageUrl") %>" width="150" height="191" /> </td>
<td height="20" colspan="2" align="center">
<%# Eval("ProductName").ToString().Substring(0, 10)%> </td>
<td height="19" colspan="2" align="center">
<span class="STYLE2">尺码:M L </span> </td>
<td height="19" colspan="2" align="center">
市场价: ¥ <%# string.Format("{0:f2}",Eval("CCPrice"))%> </td>
<td height="19" colspan="2" align="center">
会员价: ¥ <%# string.Format("{0:f2}",Eval("HYPrice"))%> </td>
<td height="31" align="center">
<a href="gwc.aspx"> <img src="images/w3.jpg" width="70" height="31" border="0" /> </a> </td>
<td>
<a href='scj.aspx?productName= <%# Eval("ProductName")%>&edit=1'> <img height="31" src="images/w4.jpg" width="70" border="0" /> </a> </td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
cpp2017 2009-08-01
  • 打赏
  • 举报
回复
2楼的朋友,重敲遍代码也用不了多少时间啊。
zhubo_1117 2009-08-01
  • 打赏
  • 举报
回复
用DataList
设置

RepeaterColumns= 5
cpp2017 2009-08-01
  • 打赏
  • 举报
回复
用DataList
设置

RepeaterColumns= 5
lqx_6968 2009-08-01
  • 打赏
  • 举报
回复
在属性面板中设置DataList
RepeatDirection = Horizontal;
RepeatColumns = 5;
chenger19890917 2009-08-01
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 cpp2017 的回复:]
2楼的朋友,重敲遍代码也用不了多少时间啊。

[/Quote]
说真的,我觉得点击引用还要快一点,哈哈
IHandler 2009-08-01
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 cpp2017 的回复:]
2楼的朋友,重敲遍代码也用不了多少时间啊。

[/Quote]
就像老师批作业那样,看到错都错一样 ,呵呵 - -

在属性面板中设置DataList
RepeatDirection = Horizontal;
RepeatColumns = 5;
jin8520 2009-08-01
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 cpp2017 的回复:]
2楼的朋友,重敲遍代码44444444
[/Quote]
555555555555
导言   在之前的28篇教程的例子里,如果我们需要显示某个数据源的多条记录,我们使用GridView .GridView 的一行表示数据源的一条记录,列表示一个字段.虽然GridView 用来显示数据,分页,排序,编辑,删除非常的方便,但是有点臃肿.而且GridView 结构的标记是固定的—它包含一个带有和的HTML 标记.   为了在显示多条记录时,有更好的自定义功能,ASP.NET 2.0提供了DataList 和Repeater (ASP.NET 1.x版本里也有 ).DataList 和Repeater 使用模板来显示内容,而不是象在GridView里那样

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧