468,294 Members | 1,807 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,294 developers. It's quick & easy.

Master / details grid

M
Hy,
I would like to create a master /detail datagrid,
that is a datagrid that (when I click on an item)
shows some other item's details
expanding the rows under the selected grid

Can someone help me with this?

Thanks!

M@
Nov 18 '05 #1
4 1264
I do not know of one exactly like you describe, but Dino Esposito created a
1.1 version of the DetailsView control from 2.0 Framework (Visual Studio
2005, now in beta):

http://msdn.microsoft.com/asp.net/co...etailsview.asp

Good code sample and it might help you with your issue.
---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"M@" wrote:
Hy,
I would like to create a master /detail datagrid,
that is a datagrid that (when I click on an item)
shows some other item's details
expanding the rows under the selected grid

Can someone help me with this?

Thanks!

M@

Nov 18 '05 #2
Try this

http://www.dotnetjunkies.com/Tutoria...63C4C9BBC.dcik

Vinay

"M@" wrote:
Hy,
I would like to create a master /detail datagrid,
that is a datagrid that (when I click on an item)
shows some other item's details
expanding the rows under the selected grid

Can someone help me with this?

Thanks!

M@

Nov 18 '05 #3
M,
I have done this in a web application I wrote. As you probably know, the
datagrid web control does not inherently support master-detail datagrids.
What you need to do is:

1. Add a select button column to your datagrid (a simple google search
will give you simple instructions on this
2. Perhaps change the "selecteditem" style to bold or something to make
it stand out
3. Add the following to your html tag for the datagrid:
"Onselectedindexchanged = "datagrid1_SelectedIndexChanged" This will fire
an event when you hit the select button for a particular row in your
datagrid
4. Set your "DataKeyField" property on the datagrid to the table's field
value that links it to the detail datagrid (usually a primary key field i.e.
AuthorID)
5. Create a second datagrid (your detail datagrid)
6. In the datagrid1_SelectedIndexChanged Sub, set up and execute a
connection/command with a SQL statement that references the selectedindex of
the master datagrid in the WHERE clause of your SQL statement (i.e. SELECT
booktitles, ISBNNumber FROM tbl_Books WHERE AuthorID =
datagrid1.items.item(datagrid1.selecteditem.itemin dex).Cells(0).Text
7. Bind your detail datagrid and refresh the page

That should get you started in the right direction.

"M@" <no*@sorry.com> wrote in message
news:Cj********************@twister1.libero.it...
Hy,
I would like to create a master /detail datagrid,
that is a datagrid that (when I click on an item)
shows some other item's details
expanding the rows under the selected grid

Can someone help me with this?

Thanks!

M@

Nov 18 '05 #4
M
> 5. Create a second datagrid (your detail datagrid)

Ok, that's correct, but the effect I would like ti reproduce is different:
only one datagrid, when the user click on the item
the selected row expands itself and shows
some detailed information.

Have you ever seen some grid like this?

Thanks

M@
Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Bala | last post: by
2 posts views Thread by HS1 | last post: by
1 post views Thread by brian.newman | last post: by
reply views Thread by Mike Wilson | last post: by
3 posts views Thread by Gina_Marano | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.