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 Issue

Datagrid Issue

Scheduled Pinned Locked Moved C#
helpquestioncss
3 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.
  • U Offline
    U Offline
    User 4005525
    wrote on last edited by
    #1

    Hi I have to display more than one button control Within a Single column of Grid control. How can i Achieve this? can anyone help me? thanks in advance bye sri

    H J 2 Replies Last reply
    0
    • U User 4005525

      Hi I have to display more than one button control Within a Single column of Grid control. How can i Achieve this? can anyone help me? thanks in advance bye sri

      H Offline
      H Offline
      Harini N K
      wrote on last edited by
      #2

      Hi You can use TemplateColumn and add as many as button within the template column.

      Harini

      1 Reply Last reply
      0
      • U User 4005525

        Hi I have to display more than one button control Within a Single column of Grid control. How can i Achieve this? can anyone help me? thanks in advance bye sri

        J Offline
        J Offline
        John_Adams
        wrote on last edited by
        #3

        Hi Sri, I have another way to do this, we can take the following steps: 1). Make a usercontrol to host buttons, the CustomButtonControl class which inherited from usercontrol. 2). Create a CustomButtonControl instance(NOTICE: we just need one), add it into the control collection of the DataGridView, initially make it invisible. 3). Handle the DataGridView.CellPainting event to draw a textbox and button style on the cell, which make the cell looked like some kind hosting a usercontrol in it. 4). Handle the DataGridView.CellBeginEdit event to show the usercontrol right in the cell while editing, you can edit in the textbox in the usercontrol and click the button, write your logic in the Click event of the button, I just show a message box for example in this sample. 5). Handle the DataGridView.CellEndEdit event to update the cell value. 6). Handle the DataGridView.Scroll event to reset the location and size of the usercontrol while scrolling. Without handling this, the usercontrol would stay still while scrolling. Hope this will help you in moving forward in your task :).

        Regards, John Adams ComponentOne LLC

        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