Datagridview -can multiple rows affect sub records?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gun Slinger
    New Member
    • Feb 2008
    • 27

    #1

    Datagridview -can multiple rows affect sub records?

    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
    Last edited by Frinavale; Feb 18 '09, 04:13 PM. Reason: Moved to C# Answers from .NET
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    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?)

    Comment

    • Gun Slinger
      New Member
      • Feb 2008
      • 27

      #3
      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

      Comment

      • Gun Slinger
        New Member
        • Feb 2008
        • 27

        #4
        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?

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          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")

          Comment

          • Gun Slinger
            New Member
            • Feb 2008
            • 27

            #6
            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....

            Comment

            • Frinavale
              Recognized Expert Expert
              • Oct 2006
              • 9749

              #7
              Originally posted by Gun Slinger
              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?
              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.

              Originally posted by Gun Slinger
              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....
              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

              Comment

              Working...