Click here to Skip to main content
Rate this: bad
good
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 at 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 at 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
0 Sergey Alexandrovich Kryukov 535
1 OriginalGriff 275
2 BillWoodruff 260
3 Shweta N Mishra 244
4 Deepu S Nair 230
0 OriginalGriff 6,168
1 Sergey Alexandrovich Kryukov 5,818
2 DamithSL 4,958
3 Manas Bhardwaj 4,539
4 Maciej Los 3,755


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.1 | Last Updated 18 Jun 2012
Copyright © CodeProject, 1999-2014
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