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. C#
  4. datagrid problem....

datagrid problem....

Scheduled Pinned Locked Moved C#
databaseregexhelpquestion
4 Posts 3 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
    sindhutiwari
    wrote on last edited by
    #1

    Hi, two questions 1. i want to bind a database table to a datagridview and few of the columns must have cell format as datagridview combo box ... 2. if question one is solved then..see to this.... one of the column contains item list along with its values i am storing the item names in the combobox and the values as cell.value... now what i need is when i am retriving the database the particular columns must have cell type as combobox and the values for the cell must match the combobox list item regards sindhu tiwari

    its me sid

    A 1 Reply Last reply
    0
    • S sindhutiwari

      Hi, two questions 1. i want to bind a database table to a datagridview and few of the columns must have cell format as datagridview combo box ... 2. if question one is solved then..see to this.... one of the column contains item list along with its values i am storing the item names in the combobox and the values as cell.value... now what i need is when i am retriving the database the particular columns must have cell type as combobox and the values for the cell must match the combobox list item regards sindhu tiwari

      its me sid

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      sindhutiwari wrote:

      1. i want to bind a database table to a datagridview and few of the columns must have cell format as datagridview combo box ...

      Use ItemTemplate Field and use Combox in It!! your problem will solve Steps a)add a column to the gridview which is a TemplateField b)Edit the templateField and drag ComboBox into the template!

      sindhutiwari wrote:

      2. if question one is solved then..see to this....

      Try to do this first one , after that you can do this one also . This is For your reference!!! Reference!!!![^]

      Best Regards ----------------- Abhijit Jana View My CodeProject Articles "Success is Journey it's not a destination"

      S 1 Reply Last reply
      0
      • A Abhijit Jana

        sindhutiwari wrote:

        1. i want to bind a database table to a datagridview and few of the columns must have cell format as datagridview combo box ...

        Use ItemTemplate Field and use Combox in It!! your problem will solve Steps a)add a column to the gridview which is a TemplateField b)Edit the templateField and drag ComboBox into the template!

        sindhutiwari wrote:

        2. if question one is solved then..see to this....

        Try to do this first one , after that you can do this one also . This is For your reference!!! Reference!!!![^]

        Best Regards ----------------- Abhijit Jana View My CodeProject Articles "Success is Journey it's not a destination"

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

        i neede it in desktop application

        its me sid

        G 1 Reply Last reply
        0
        • S sindhutiwari

          i neede it in desktop application

          its me sid

          G Offline
          G Offline
          Gopal S
          wrote on last edited by
          #4

          Hi sindhutiwari, 1) First retrive the data from database to DataTable. DataTable objDataTable = new DataTable(); objDataTable.Columns.Add("DataColumn1"); objDataTable.Columns.Add("DataColumn2"); dr = objDataTable.NewRow(); dr[0] = "data1"; dr[1] = "yes" objDataTable.Rows.Add(dr); 2) Now you can bind this datatable to datagridview. You should set the "DataPropertyName" property of datagridview column. grdView.DataSource = objDataTable; this.grdColumn1.DataPropertyName = "DataColumn1"; this.grdColumn2.DataPropertyName = "DataColumn2"; // grdColumn2 is comboboxcell it contains 2 items (yes/no). other values not accepted. Regards,

          Gopal.S

          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