Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 19th, 2005, 02:34 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default Datagrid - Is there a way to "tie" rows?

I expect the answer is no....

Is there a way to do this:

First Name | Last name
Address
First Name | Last Name
Address

Which means I am taking two rows of a grid and tying the information together...

Using, of course, the default grid...



Hal Levy
I am here to help you, not do it for you.
That is, unless you hire me. I am looking for work.
__________________
Hal Levy
 
Old July 19th, 2005, 03:10 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Hal,

Lucky for you, the answer is possibly yes.

You can't do this declaratively, but you can do this in code.

If you set up an ItemCreated or ItemDataBoud event handler for the grid, you can get access to the full Grid elements.

Inside that event, you could get a handler to the currently added row. Once you have that row, what you do with it is up to you. Adding a simple colspan for the address column is pretty easy. You can remove the second column, then set colspan to 2 for the first row.

However, the rowspan might be a bit trickier. I think the easiest way to do it is somehow pass some info with the address column to indicate it should be merged with the previous column. Then get a reference to the previous one, copy the data over to the address row, and remove the first name row.

Or, maybe a lot easier, remove the top border from the address column to make it appear the rows are merged.

Another solution is to use a template column with fields bound to first name, last name and address......

I have some code somewhere that merges columns, so if you need more help, please let me know.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Alles by Brainpower (Track 7 from the album: Even Stil) What's This?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Move Datagrid rows michael29 ASP.NET 1.0 and 1.1 Professional 1 April 24th, 2007 05:31 PM
how can i cover all datagrid rows ??? thomaz C# 1 November 30th, 2006 10:19 PM
How to add rows in DataGrid ? vivekian ASP.NET 1.0 and 1.1 Professional 0 March 13th, 2005 04:30 AM
rows in Datagrid drachx General .NET 0 October 20th, 2004 08:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.