简体   繁体   English

SQL结果显示asp.net vb.net

[英]SQL result presentation asp.net vb.net

I have table called tblA that looks like this 我有一个名为tblA的表,看起来像这样

| FileName   | ProductName | 
|:-----------|:------------|
| 12345.jpg  |Honda        |
| 14578.jpg  |Toyota       |
| 11475.jpg  |Honda        |
| 11457.jpg  |Nissan       |
| 11145.jpg  |Honda        |
| 24879.jpg  |BMW          |
| 22222.jpg  |Honda        |
| 21545.jpg  |Honda        |
| 55552.jpg  |Honda        |

I am building an ASP.net VB.net website using gridView. 我正在使用gridView构建ASP.net VB.net网站。 If I do this query 如果我执行此查询

select FileName from tblA where ProductName = 'Honda'

Then I want my asp.net gridview to show up like this: 然后我希望我的asp.net gridview显示如下:

|12345.jpg  |11475.jpg  |11145.jpg  |
|22222.jpg  |21545.jpg  |55552.jpg  |

Essentially like craigslist when you select the result to show side by side with pictures. 选择结果与图片并排显示时,基本上像craigslist。

Can you please give me to the correct direction on how to do this with gridview? 您能否给我正确的方向,说明如何使用gridview?

If gridview is not the right approach then do I have to create a loop and build my own DIV HTML in VB.net? 如果不是正确的方法,那么是否必须在VB.net中创建循环并构建自己的DIV HTML?

thank you 谢谢

You have to use DataList control to achieve this and have to use properties RepeatColumns =3, RepeatDirection = RepeatDirection.Horizontal. 您必须使用DataList控件来实现此目的,并且必须使用属性RepeatColumns = 3, RepeatDirection = RepeatDirection.Horizo​​ntal。 You may also need to set RepeatLayout property. 您可能还需要设置RepeatLayout属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM