I created an unbounded column and add a button to it. But when I clicked the button, then event below did not fire! What am I missing?
<ig:XamGrid.Columns> <ig:UnboundColumn Key="Edit" HeaderText="Edit" HorizontalContentAlignment="Center"> <ig:UnboundColumn.ItemTemplate> <DataTemplate> <Button Content="Edit" Name="btnEditData" /> </DataTemplate> </ig:UnboundColumn.ItemTemplate> </ig:UnboundColumn> </ig:XamGrid>
Private Sub btnEditData_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnEditData.Click messagebox.show("This button fires") End Sub
Thanks. I now am able to get the row data. I used VB, so I converted the C# code to VB: Dim edtButton As Button edtButton = sender Dim cellOj As Infragistics.Controls.Grids.CellControl cellOj = edtButton.Parent Dim clickedRow As Infragistics.Controls.Grids.RowBase clickedRow = cellOj.Cell.Row cvnum = clickedRow.Cells("CVNum").Value
Hi,
you can obtain the row by looking at the parent cell of the button
C# example:
private void btnEditData_Click(object sender, RoutedEventArgs e)
{
Row clickedRow = ((CellControl)((Button)sender).Parent).Cell.Row as Row;
// Do your stuff ...
}
Hope that helps,
After I added the Click="btnEditData_Click" to the line below, the event fires, but now I don't know which row was clicked?
<
Button Content="Edit" Name="btnEditData" Click="btnEditData_Click" />