gridview水平列 [英] gridview horizentaly columns

查看:68
本文介绍了gridview水平列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个gridview
此gridview显示表的9列
每列包含{1个图像和3个标签}
我想将我的gridview对齐以显示3行中的列
每行包含3列表格
例如:
1 2 3
4 5 6
7 8 9

每个数字都是表格的一列
horizentaly columns

i have a gridview
this gridview show 9 columns of a table
each columns is contain{ 1 image, and 3 label}
i want align my gridview for show column in 3 row
each row contain 3 columns of table
example:
1 2 3
4 5 6
7 8 9

each nuber is a columns of table
horizentaly columns

推荐答案

在这种情况下,如果您使用DataList,那就很麻烦了;

仅因为DataList控件比GridView更灵活;

现在,您必须要做的是创建DataList.

1.在创建一个ImageTemplate和一个三个Label的同时,创建一个ItemTemplate将此控件放入您的Item Template.
2. DataList有一个名为RepeatColumns的属性,此属性将帮助您以格式设置数据,将此属性设置为3.

就这样..
现在,只需将控件与DataSource绑定即可.

最好的
In this case It is batter if you use DataList;

Only because The DataList control is more flexible then GridView;

Now what you have to do for creating DataList.

1. Create an ItemTemplate as you meson one Image and three label put this control in your Item Template.
2. DataList has one property called RepeatColumns this property will help for arranging you data in your format set this property to 3.

That''s It..
Now just bind the control with DataSource.

All the best


您可以使用转发器或列表视图控件

请参阅下面给出的链接

http://www.codeproject.com/Questions/395545/Single-Database-row-into-2-rows-in-gridview-in-csh
You can make use of repeater or listview controls

Refer the link given below

http://www.codeproject.com/Questions/395545/Single-Database-row-into-2-rows-in-gridview-in-csh


前几天我也面临着同样的问题.但在不同的情况下.我应该转置数据行,然后填充库斯图控件.

是什么建议您而不是让每张图片和最费劲的9牙膏..尝试将它们作为行..

像:

图片|标签1 |标签2
---------------------------------
A.png | bla | blabla
--------------------------------
b.png | bla2 | bla 3
.
.
.
.

最高9 0r n


现在您可以拥有一个控件,可以按照您的设置进行保存(如果只有9行)


Cc1 CC2 CC3
CC4 CC5 CC6
cc7 cc8 cc9

并相应地加载值.

这只是一个逻辑.如果您要发布一些代码,我们可以提供解决方案

如果您要创建相册类型页面,则我已经准备好了代码..
Few days back i also faced the same issue. but in different context. I was supposed to tranpose the datarow and then populate the coustom control.

What will suggest you to instead of getting your 9 coloum with each image and labest .. try to get them as rows..

like :

Image | Label 1 | label2
---------------------------------
A.png | bla | blabla
--------------------------------
b.png | bla2 | bla 3
.
.
.
.

upto 9 0r n


now you can have a control which you can keep as per you setting (if you have only 9 rows)
as

Cc1 CC2 CC3
CC4 CC5 CC6
cc7 cc8 cc9

and load the values accordingly.

this is just a logic. if you will post some of you code we can come up with solution

and if you are creating a image album type page, i have codes ready for that ..


这篇关于gridview水平列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆