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. Gridview Question

Gridview Question

Scheduled Pinned Locked Moved ASP.NET
csharpcssasp-nethelp
8 Posts 2 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.
  • V Offline
    V Offline
    Vimalsoft Pty Ltd
    wrote on last edited by
    #1

    Good Afternoon All I have a Gridview that looks like this http://www.vuyiswamaseko.tiyaneproperties.co.za/images/Problem_Grid.JPG[^] As you can see in the Description Field there are Duplicates but with Different Cycle Template Field. I want my grid to look like this

    DESCR |CYCLE TEMPLATE

    Campbell Nancy |"6 10" |

    Salhab W MR |"9" |

    If it Finds a Duplicate it must Add the Cyle Template and Diplay it as a String and if there is no Duplicate , it must be Left with that String like Salhab W MR is "9" Thank you

    Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

    N 1 Reply Last reply
    0
    • V Vimalsoft Pty Ltd

      Good Afternoon All I have a Gridview that looks like this http://www.vuyiswamaseko.tiyaneproperties.co.za/images/Problem_Grid.JPG[^] As you can see in the Description Field there are Duplicates but with Different Cycle Template Field. I want my grid to look like this

      DESCR |CYCLE TEMPLATE

      Campbell Nancy |"6 10" |

      Salhab W MR |"9" |

      If it Finds a Duplicate it must Add the Cyle Template and Diplay it as a String and if there is no Duplicate , it must be Left with that String like Salhab W MR is "9" Thank you

      Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

      N Offline
      N Offline
      Nyoti Rukadikar
      wrote on last edited by
      #2

      I do not know if the way I am telling is a correct way. But I solved this problem for me like this. 1) Fetch the data from the database into datatable. 2) Create another datatable and add new row to it. 3) Get the "Description" Column and add it as a column to the new table. Get the corresponsing Cycle Template solumn and add to table. 4) Loop throught the table with table.Select() to get all the rows having same description. 5) For each such row, get the cycle template and add it to the same column (Cycle Template which you added previously) In short, create a dynamic table this way and bind it to grid. Thanks, Nyoti

      V 1 Reply Last reply
      0
      • N Nyoti Rukadikar

        I do not know if the way I am telling is a correct way. But I solved this problem for me like this. 1) Fetch the data from the database into datatable. 2) Create another datatable and add new row to it. 3) Get the "Description" Column and add it as a column to the new table. Get the corresponsing Cycle Template solumn and add to table. 4) Loop throught the table with table.Select() to get all the rows having same description. 5) For each such row, get the cycle template and add it to the same column (Cycle Template which you added previously) In short, create a dynamic table this way and bind it to grid. Thanks, Nyoti

        V Offline
        V Offline
        Vimalsoft Pty Ltd
        wrote on last edited by
        #3

        Can you please Give me an T-SQl example ? Thank you

        Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

        N 2 Replies Last reply
        0
        • V Vimalsoft Pty Ltd

          Can you please Give me an T-SQl example ? Thank you

          Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

          N Offline
          N Offline
          Nyoti Rukadikar
          wrote on last edited by
          #4

          With T-SQL you will return an input from select query, which will look something like this. Description Cost Template description1 9 description2 10 description1 29 description3 8 description3 4 Get this into a datatable. You can do it either using adaptor.Fill (Dataset) and then dataset.Tables[0] Let me know if I understood your question correctly. Thanks.

          V 1 Reply Last reply
          0
          • V Vimalsoft Pty Ltd

            Can you please Give me an T-SQl example ? Thank you

            Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

            N Offline
            N Offline
            Nyoti Rukadikar
            wrote on last edited by
            #5

            I can post the code may be by EOD today for this. Thanks, Nyoti

            V 1 Reply Last reply
            0
            • N Nyoti Rukadikar

              I can post the code may be by EOD today for this. Thanks, Nyoti

              V Offline
              V Offline
              Vimalsoft Pty Ltd
              wrote on last edited by
              #6

              Thanks

              Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

              1 Reply Last reply
              0
              • N Nyoti Rukadikar

                With T-SQL you will return an input from select query, which will look something like this. Description Cost Template description1 9 description2 10 description1 29 description3 8 description3 4 Get this into a datatable. You can do it either using adaptor.Fill (Dataset) and then dataset.Tables[0] Let me know if I understood your question correctly. Thanks.

                V Offline
                V Offline
                Vimalsoft Pty Ltd
                wrote on last edited by
                #7

                I wanted to do this in one side , if it can be done in SQl, then The SP should return a Complete data that does not need any manipulation from the C# side, if this can be done from C# side , then the Data can come in Duplicate manner and can be manupilated from C# side only. Thank you,

                Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

                N 1 Reply Last reply
                0
                • V Vimalsoft Pty Ltd

                  I wanted to do this in one side , if it can be done in SQl, then The SP should return a Complete data that does not need any manipulation from the C# side, if this can be done from C# side , then the Data can come in Duplicate manner and can be manupilated from C# side only. Thank you,

                  Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

                  N Offline
                  N Offline
                  Nyoti Rukadikar
                  wrote on last edited by
                  #8

                  I think manipulation on C# side is better than looping at the stored procedure level. (Writing cursur,fetching the data and manipulate eaither into a string or temp table is I think expensive) Thanks, Nyoti

                  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