Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Some GridView controls are running empty rows. Any ideas to fix

Some GridView controls are running empty rows. Any ideas to fix

Scheduled Pinned Locked Moved ASP.NET
databasehtmljsonhelpquestion
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    samflex
    wrote on last edited by
    #1

    Greetings again, Please forgive me for posting too much code. I am trying to post something that gives an idea of what I am struggling with. Looking at the code, you can see there are 7 controls, GridView1, gvspouse, etc. When the user queries the DB and there is say one row of data for say GridView1, the rest of the controls display one row of data. This is fine. However, if the query returns two or more rows of data for one control, usually the rest of controls will show two or more empty rows of data. This is not good. We would like only the controls with two or more rows of data to return those rows and those controls that don't have any data to return just one row so user can fill that row if need be or leave it empty. Is this possible? Again, I apologize for too much code. My hope is that it helps convey the point I am trying to make when I say seven GridView controls. Many thanks in advance

    /HTML
    Name, title, and email address of employee filling this form

           Enter your Employee Id to begin\*
    
    L M B 3 Replies Last reply
    0
    • S samflex

      Greetings again, Please forgive me for posting too much code. I am trying to post something that gives an idea of what I am struggling with. Looking at the code, you can see there are 7 controls, GridView1, gvspouse, etc. When the user queries the DB and there is say one row of data for say GridView1, the rest of the controls display one row of data. This is fine. However, if the query returns two or more rows of data for one control, usually the rest of controls will show two or more empty rows of data. This is not good. We would like only the controls with two or more rows of data to return those rows and those controls that don't have any data to return just one row so user can fill that row if need be or leave it empty. Is this possible? Again, I apologize for too much code. My hope is that it helps convey the point I am trying to make when I say seven GridView controls. Many thanks in advance

      /HTML
      Name, title, and email address of employee filling this form

             Enter your Employee Id to begin\*
      
      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You need to remove all the unnecessary code from that post and explain exactly where the error occurs. Please don't just dump everything and leave it to us to try and figure out what you are referring to.

      S 1 Reply Last reply
      0
      • L Lost User

        You need to remove all the unnecessary code from that post and explain exactly where the error occurs. Please don't just dump everything and leave it to us to try and figure out what you are referring to.

        S Offline
        S Offline
        samflex
        wrote on last edited by
        #3

        Thank you sir for your response but you didn't have to respond if the question makes no sense to you. This is the way you have always responded to any post by anyone.

        L 1 Reply Last reply
        0
        • S samflex

          Thank you sir for your response but you didn't have to respond if the question makes no sense to you. This is the way you have always responded to any post by anyone.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          How to get an answer to your question - ASP.NET Discussion Boards[^]

          1 Reply Last reply
          0
          • S samflex

            Greetings again, Please forgive me for posting too much code. I am trying to post something that gives an idea of what I am struggling with. Looking at the code, you can see there are 7 controls, GridView1, gvspouse, etc. When the user queries the DB and there is say one row of data for say GridView1, the rest of the controls display one row of data. This is fine. However, if the query returns two or more rows of data for one control, usually the rest of controls will show two or more empty rows of data. This is not good. We would like only the controls with two or more rows of data to return those rows and those controls that don't have any data to return just one row so user can fill that row if need be or leave it empty. Is this possible? Again, I apologize for too much code. My hope is that it helps convey the point I am trying to make when I say seven GridView controls. Many thanks in advance

            /HTML
            Name, title, and email address of employee filling this form

                   Enter your Employee Id to begin\*
            
            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            At a guess (I refuse to wade through your entire code block) you are binding all gridviews to the one collection, you probably need to create a collection for each gridview with only the relevant data in it. Richards comment is perfectly valid.

            Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

            S 1 Reply Last reply
            0
            • M Mycroft Holmes

              At a guess (I refuse to wade through your entire code block) you are binding all gridviews to the one collection, you probably need to create a collection for each gridview with only the relevant data in it. Richards comment is perfectly valid.

              Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

              S Offline
              S Offline
              samflex
              wrote on last edited by
              #6

              No, his comment is not valid at all. First of all, I explained the issue that I am having. If I had done that and not show any code, he would have come back and ask for code. Most of the code is HTML just to show the many gridview controls I am using and just one method on codebehind which in my view is the code that I believe needs modification. I am still working on it on my way and if I can get it resolved, I will post it for Richard. BTW, this is who he is. He is pretty good at yelling at posters but I have not seen any real solution he has provided to any questions here. Sorry, I don't mean to be mean but I truly dislike when someone yells at you but does not have the ability to help solve your problem. At least you attempted a solution. I can deal with criticisms if an attempt is made to help if the help doesn't solve your problem.

              P L 2 Replies Last reply
              0
              • S samflex

                No, his comment is not valid at all. First of all, I explained the issue that I am having. If I had done that and not show any code, he would have come back and ask for code. Most of the code is HTML just to show the many gridview controls I am using and just one method on codebehind which in my view is the code that I believe needs modification. I am still working on it on my way and if I can get it resolved, I will post it for Richard. BTW, this is who he is. He is pretty good at yelling at posters but I have not seen any real solution he has provided to any questions here. Sorry, I don't mean to be mean but I truly dislike when someone yells at you but does not have the ability to help solve your problem. At least you attempted a solution. I can deal with criticisms if an attempt is made to help if the help doesn't solve your problem.

                P Offline
                P Offline
                phil o
                wrote on last edited by
                #7

                The ability to isolate an issue and strip off all which is not relevant is a skill. A huge lot of unformatted code is just distracting; someone with no knowledge of your issue won't want to wade through all that code to try and find what is the problem and where it lies. Especially when the description of the problem does not immediately make sense. So we need you to do this primary filtering job. This will allow us to provide better ideas towards resolution. Because, you know, we have lives and jobs, too.

                "Five fruits and vegetables a day? What a joke! Personally, after the third watermelon, I'm full."

                1 Reply Last reply
                0
                • S samflex

                  No, his comment is not valid at all. First of all, I explained the issue that I am having. If I had done that and not show any code, he would have come back and ask for code. Most of the code is HTML just to show the many gridview controls I am using and just one method on codebehind which in my view is the code that I believe needs modification. I am still working on it on my way and if I can get it resolved, I will post it for Richard. BTW, this is who he is. He is pretty good at yelling at posters but I have not seen any real solution he has provided to any questions here. Sorry, I don't mean to be mean but I truly dislike when someone yells at you but does not have the ability to help solve your problem. At least you attempted a solution. I can deal with criticisms if an attempt is made to help if the help doesn't solve your problem.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  I have not yelled at anyone. I merely suggested that if you want help then you need to help us. You need to understand that we have never seen your code before so have no idea of the thinking or the logic behind it. We rely on you, the poster, to explain in simple terms what the issue is and where it occurs. Without that information we are floundering in the dark.

                  1 Reply Last reply
                  0
                  • S samflex

                    Greetings again, Please forgive me for posting too much code. I am trying to post something that gives an idea of what I am struggling with. Looking at the code, you can see there are 7 controls, GridView1, gvspouse, etc. When the user queries the DB and there is say one row of data for say GridView1, the rest of the controls display one row of data. This is fine. However, if the query returns two or more rows of data for one control, usually the rest of controls will show two or more empty rows of data. This is not good. We would like only the controls with two or more rows of data to return those rows and those controls that don't have any data to return just one row so user can fill that row if need be or leave it empty. Is this possible? Again, I apologize for too much code. My hope is that it helps convey the point I am trying to make when I say seven GridView controls. Many thanks in advance

                    /HTML
                    Name, title, and email address of employee filling this form

                           Enter your Employee Id to begin\*
                    
                    B Offline
                    B Offline
                    Blikkies
                    wrote on last edited by
                    #9

                    Instead of binding all gridviews to one DataTable, bind each grid to a different dataView of the same DataTable: e.g.

                    Gridview1.DataSource = New DataView(ds)
                    Gridview1.DataBind()
                    grvspouse.DataSource = New DataView(ds)
                    grvspouse.DataBind()
                    grvDiv.DataSource = New DataView(ds)
                    grvDiv.DataBind()
                    ...
                    ...

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups