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

Datagridview -can multiple rows affect sub records?

P: 27
Hi guys,

I have a quick question which i have pondered for a little while. I'm not sure if its even a good idea (so maybe advice on whether or not to do it would be helpful as well).

I want to have my first datagridview to have a multi-select (which i have currently), but what i want to happen when multiple rows are selected is different. I have a sub datagridview which is using a relationship in a dataset which allows the two datagridviews to interact with each other.

When i select more than one row in the parent datagridview, i want the sub-datagridview to show the records for all parent records selected, so record A has 4 sub items and record B has 3, therefore 7 records are now shown. Is this possible?

Cheers,
Gun slinger
Feb 3 '09 #1
Share this Question
Share on Google+
6 Replies


Frinavale
Expert Mod 5K+
P: 9,731
When you say "sub DataGridView" do you mean aDataGridView within a parent DataGridView?
Or do you simply mean that there are 2 GridViews on the page?

What you are attempting to do is possible.
All you have to do is update the data source for your "sub GridView".

(PS what language are you implementing your solution in?)
Feb 4 '09 #2

P: 27
Thanks for the reply Frinavale.

My language is C#. There are two datagridviews (sometimes more, depending on my program). One of them is technically a sub datagridview because it uses a child datasource from a dataset relation.

I understood that it might be possible, however, i wanted to know if it was easy to implement without having to rewrite the entire datagridview by inheriting it and making my own datagridview.

So basically i have to make it when i select a row on the parent, i update the childs select statement to be, " Where ID = '1' and ID = '2'" or something like that? Let me know if thats the only way to do it.

Cheers
Feb 5 '09 #3

P: 27
Hi guys,

Has anyone got a solution for this? I would like to be able to add it easily, but if i have to do it manually, is there a project already in existence?
Feb 18 '09 #4

Frinavale
Expert Mod 5K+
P: 9,731
You can search for a project if you want to but from the sounds of it you're going to want to write this yourself.

You should see if templates would help you in your solution (instead of "sub GridViews")
Feb 18 '09 #5

P: 27
Cheers.

Bugger, this might be a little bit painful to make. Also, just out of interest, that template field only seems to be for asp.net, as a web UI control, not a form control?

Before i make a commitment to making a control capable of something such as what i have described. Does it actually sound like a good way to allow the user to interact with a database type program? I mean, if there isn't something already implemented, that means that there isn't a large deal of interest for something like that i guess....
Feb 18 '09 #6

Frinavale
Expert Mod 5K+
P: 9,731
@Gun Slinger
Right before I read your response I thought to myself "I'm an idiot: he's asking about a DataGridView not a GridView". I'm sorry, that template field is a powerful tool used with ASP.NET GridViews and doesn't apply to your problem.

@Gun Slinger
I find that having tables within tables within tables gets confusing to the end user. My designs tend to be linear so that it is easy for the end user to read.

I've had situations where sub grids would have been used but opted for a "show details" button instead that would display the extra details in a separate control in it's own window/section on the screen.

Not all solutions can implement such a method and you may decide that this isn't feasible.

-Frinny
Feb 18 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.