472,961 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,961 software developers and data experts.

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 3215
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.