By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,092 Members | 1,546 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,092 IT Pros & Developers. It's quick & easy.

Master / details grid

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.