Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted
Comments
[no name] 17-Jun-12 12:00pm    
And? Did you forget to ask a question? What sort of help are you looking for? How to populate a grid? Query a database? Assign a value to a cell?
Sandeep Mewara 17-Jun-12 12:14pm    
And the issue is?

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
 
Share this answer
 
v2
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
 
Share this answer
 
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 ..
 
Share this answer
 
this could help you as well;

C#
   c0.Text = "<br />" + Convert.ToString(dvSql.Table.Rows[i][1]) + "<br />" + Convert.ToString(dvSql.Table.Rows[i][2]) + "<br />" + Convert.ToString(dvSql.Table.Rows[i][3]);
 row.Cells.Add(c0);
Table1.Rows.Add(row);


i create at table at run time and change the formatting of rows and coloums as per my need
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900