Does someone know how to add button into the datagrid rows like a delete button?
Any suggestions or samples will be appreciated.
Hi,
If you are trying to trap a click on a cell button, you should be using the ClickCellButton event, not ClickCell.
ClickCell doesn't fire because the button handles the click before it gets to the cell.
I am using C#. As I stated I used the methods supplied in this article but for one reason or another a click on the (button) column is not acknowledged in the ClickCell event. Here is a brief extract of my code:
e) {
{
// attach run time events.
gvShopVueOrders.ClickCell +=
(gvShopVueOrders_ClickCell); gvShopVueOrders.InitializeRow +=
gvShopVueOrders.InitializeRow +=
(gvShopVueOrders_InitializeRow);
// add button column
layout = e.Layout;
band = layout.Bands[1];
)) {
); viewHoursButtonColumn.Style = Infragistics.Win.UltraWinGrid.
viewHoursButtonColumn.Style = Infragistics.Win.UltraWinGrid.
.Button; viewHoursButtonColumn.CellButtonAppearance.ForeColor =
viewHoursButtonColumn.CellButtonAppearance.ForeColor =
.Black; viewHoursButtonColumn.CellButtonAppearance.BackColor =
viewHoursButtonColumn.CellButtonAppearance.BackColor =
.LightBlue; viewHoursButtonColumn.CellAppearance.ForeColor =
viewHoursButtonColumn.CellAppearance.ForeColor =
.Black; viewHoursButtonColumn.CellAppearance.BackColor =
viewHoursButtonColumn.CellAppearance.BackColor =
.LightBlue; viewHoursButtonColumn.SortIndicator =
viewHoursButtonColumn.SortIndicator =
.None; viewHoursButtonColumn.Key =
viewHoursButtonColumn.Key =
;
}
...
Click Event (note this event fires for all columns cells except the button column):
.Show(e.Cell.Column.Key);
) {
+ e.Cell.Row.Cells[1].Text); } }
... Initialize Row Event:
)) { e.Row.Cells[
e.Row.Cells[
; e.Row.Cells[
; } }
----Essentially what I am trying to do is this - when the column button is clicked I want to display a message box with the text values of column cell 0 and a 1. The ulimate goal is to be able to use these row level column values to call a class method that will return data based on those values and display in the Message box.
I'm afraid I am not following you. Why can't you hook up the event programmatically? There's no difference between the ClickCellButton event and any other event in this regard.
Are you saying you are simply not sure how to hook any event in code? That really has nothing specifically to do with the Infragistics controls, so you might want to seek assistance on a more general Microsoft DotNet coding forum for a question like that.
What language are you programming in?
But the question is, hooking up the cell to react to a click. I implemented the code shown above, but there doesn't seem to be a way to hook up the event (clickcellbutton) programmatically.
Thanks for your quick response