add "spacers to gridview"

G

Guest

How can I add a empty row to my gridview?

example:
column 1 column2
row 1
row2
row3
row4
empty row across the grid
row5
row6
row7
row8
empty row across the grid

and so on
 
B

Bruno Alexandre

you need to get the info from whatever you are getting (DB 4 example)
and add into a datatable
then bind the datatable to the gridview

....
dr = command.executeReader()
while dr.read()
iRows += 1

r = dt.newRow()
r("column1") = dr.item("myColumn").toString
...
dt.rows.add(r)

if iRows mod 4 = 0 then
r = dt.newRow()
dt.Rows.Add(r)
end if

end while

....

gridView.DataSource = dt
gridView.DataBind()



that example will add an empty row to the Datatable each 4 rows

--

Bruno Alexandre
København, Danmark

"a Portuguese in Denmark"

Blog. http://balexandre.blogspot.com/
Photos. http://www.flickr.com/photos/balexandre/
 
C

Cowboy \(Gregory A. Beamer\)

You can use the databinding event to alter rows. You should be able to add
rows, as well, at this step. Using Mod 4, you will have one after every
four.
 
E

Eliyahu Goldin

I can think about something like this:

Replace the gridview with a repeater
Make an item template that will include 2 table rows.
Databind the cells in the first row to the fields for column1 and column2.
Live the cells in the second row empty and make the second row hidden.
Handle the repeater's PreRender event. Loop through the repeater items and
show the second row in every 5th item.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top