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. General Programming
  3. Visual Basic
  4. binding data with gridview

binding data with gridview

Scheduled Pinned Locked Moved Visual Basic
databasewpfwcfdesignhelp
8 Posts 4 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.
  • K Offline
    K Offline
    KIDYA
    wrote on last edited by
    #1

    Hello Experts, I am designing columns in datagridview at design time and bind data at run time using dataset...But it shows in gridview my columns(designtime) and dataset column at a time. Waht to do with this? I dont want to change column header order!! It shows according to database column order!! Please help!!

    J L 2 Replies Last reply
    0
    • K KIDYA

      Hello Experts, I am designing columns in datagridview at design time and bind data at run time using dataset...But it shows in gridview my columns(designtime) and dataset column at a time. Waht to do with this? I dont want to change column header order!! It shows according to database column order!! Please help!!

      J Offline
      J Offline
      Johan Hakkesteegt
      wrote on last edited by
      #2

      It is difficult to say, without seeing some code, but generally speaking when adding columns to a datagridview, you can determine all kinds of stuff per column, before you add it at run time. So you could look into resorting the columns at runtime after binding the data to them. Another possibility, is to change the select clause in your query, so that the order of the columns will already be correct in the dataset.

      My advice is free, and you may get what you paid for.

      K 1 Reply Last reply
      0
      • K KIDYA

        Hello Experts, I am designing columns in datagridview at design time and bind data at run time using dataset...But it shows in gridview my columns(designtime) and dataset column at a time. Waht to do with this? I dont want to change column header order!! It shows according to database column order!! Please help!!

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

        Check to see if there is a GenerateColumns or an AutoGenerateColumns property and set it to false. You may need to write additional code to bind the design-time columns with the columns in the dataset.

        K 1 Reply Last reply
        0
        • J Johan Hakkesteegt

          It is difficult to say, without seeing some code, but generally speaking when adding columns to a datagridview, you can determine all kinds of stuff per column, before you add it at run time. So you could look into resorting the columns at runtime after binding the data to them. Another possibility, is to change the select clause in your query, so that the order of the columns will already be correct in the dataset.

          My advice is free, and you may get what you paid for.

          K Offline
          K Offline
          KIDYA
          wrote on last edited by
          #4

          ya we can reorder it using select query command, Thanks!! But i have another query is grid result show desigtime columns as well as runtime columns too!! Than how to solve this problem?

          J D 2 Replies Last reply
          0
          • L Lost User

            Check to see if there is a GenerateColumns or an AutoGenerateColumns property and set it to false. You may need to write additional code to bind the design-time columns with the columns in the dataset.

            K Offline
            K Offline
            KIDYA
            wrote on last edited by
            #5

            That autogenerate property coes into asp.net application but not in windows,i checked that one also!! Any other way?

            D 1 Reply Last reply
            0
            • K KIDYA

              ya we can reorder it using select query command, Thanks!! But i have another query is grid result show desigtime columns as well as runtime columns too!! Than how to solve this problem?

              J Offline
              J Offline
              Johan Hakkesteegt
              wrote on last edited by
              #6

              If I understood you correctly, it sounds like something is going wrong with the data binding. In other words, you have the columns from design time, and then when the data is bound during runtime, a new set of columns is created instead of the existing ones being used.

              My advice is free, and you may get what you paid for.

              1 Reply Last reply
              0
              • K KIDYA

                ya we can reorder it using select query command, Thanks!! But i have another query is grid result show desigtime columns as well as runtime columns too!! Than how to solve this problem?

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                A couple of things to check... First, in your binding code, make sure that you set the DataGridView's AutoGenerateColumns property to False. Next, make sure your Columns that you created are setup properly to bind to the appropriate table/column names in the dataset/datatable.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008
                But no longer in 2009...

                1 Reply Last reply
                0
                • K KIDYA

                  That autogenerate property coes into asp.net application but not in windows,i checked that one also!! Any other way?

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #8

                  KIDYA wrote:

                  That autogenerate property coes into asp.net application but not in windows

                  You might want to check again. DataGridView doesn't work under ASP.NET. It's a WindowForms only control. You can find the documentation on AutoGenerateColumns here[^].

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007, 2008
                  But no longer in 2009...

                  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