Click here to Skip to main content
12,248,742 members (49,413 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP ASP.NET Gridview
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 17-Jun-12 6:52am
Comments
Wes Aday 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?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

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
  Permalink  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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 ..
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

this could help you as well;

   c0.Text = "
" + Convert.ToString(dvSql.Table.Rows[i][1]) + "
" + Convert.ToString(dvSql.Table.Rows[i][2]) + "
" + 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
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160426.1 | Last Updated 18 Jun 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100