473,467 Members | 1,604 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

add "spacers to gridview"

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
Oct 16 '06 #1
3 3229
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/
"igotyourdotnet" <ig************@nospam.nospamwrote in message
news:58**********************************@microsof t.com...
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

Oct 16 '06 #2
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.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
"igotyourdotnet" <ig************@nospam.nospamwrote in message
news:58**********************************@microsof t.com...
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

Oct 16 '06 #3
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.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"igotyourdotnet" <ig************@nospam.nospamwrote in message
news:58**********************************@microsof t.com...
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

Oct 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Doc | last post by:
I've read in a couple of different places including the archives of this forum that html doesn't allow you to precisely dictate the position of an image, but I found this command (again in the...
8
by: Lian | last post by:
Hi all, It is a newbie's question about html tag "img". The attributes "title" and "alt" for "img" seems having the same function. So what is the main difference between them? Can i use them at...
1
by: Mark Richards | last post by:
I posted this earlier, and got no response. Basically I need to be able to grab a value from one of the fields in a gridView to populate a dropdown in another column of the gridview: I have a...
0
by: gui.besse | last post by:
It seems that we can't bind a collection of instance of different type. Let's have an example: // My POCO public interface ITest { string Name { get;set;} } public class A : ITest {
10
by: NH | last post by:
I have a girdview with paging enabled. How can I add a message in the footer to say "Viewing records 1-15 of 45" etc Thanks
1
by: cyningeston | last post by:
OS: WinXP Pro, VB/ASP/ADO.NET I'm building a web-based supplier management application. For each supplier we are required by the FDA to track certain documents. I've managed to pull them from...
2
by: GISmatters | last post by:
I have unbound checkboxes in a nested gridview to allow multi-selection of "child" rows. For context, the parent gridview rows are for large "reports", the child rows are for various specific files...
0
by: hhoang.nl | last post by:
I have a very weird problem with the GridView control. Here is the code: <asp:GridView runat="server" ID="gv" AutoGenerateEditButton="true" AutoGenerateSelectButton="true" AllowPaging="true"...
0
by: Dave | last post by:
I have a GridView that is being populated with the MembershipUser content. There are about 350 records being returned. I'm trying to have the GridView return to the top of the page when a user...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.