Datagrid Issue
-
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
-
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
Hi You can use TemplateColumn and add as many as button within the template column.
Harini
-
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
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