private void BtnGetValue_Click(object sender, EventArgs e)
{
txtDisplayRecord.Text = "OrderID\tCustomerID\tCustomerName\tCountry\tShipCity\tIsShipped\t";
//Get the SelectedItems Collection in SfDataGrid.SelectedItems
foreach (var selectedItem in this.sfDataGrid.SelectedItems)
{
//get the Observable collection selected row
//get the selected row value in SelectedItems collection in SfDataGrid
//by converting into underlying business object.
var dataRow = selectedItem as OrderInfo;
txtDisplayRecord.Text += dataRow.OrderID + "\t" + dataRow.CustomerID + "\t\t" + dataRow.CustomerName + "\t" + dataRow.Country + "\t" + dataRow.ShipCity + "\t" + dataRow.IsShipped + "\t";
////get the DataTable collection selected row
//var dataRow1 = (selectedItem as DataRowView).Row;
////mention the column mapping name or column index to get cell value in Selected row
//txtDisplayRecord.Text += dataRow1["OrderID"].ToString() + "\t" + dataRow1["CustomerID"].ToString() + "\t\t" + dataRow1["CustomerName"].ToString() + "\t" + dataRow1["Country"].ToString() + "\t" + dataRow1["ShipCity"].ToString() + "\t" + dataRow1["IsShipped"].ToString() + "\t";
////txtDisplayRecord.Text += dataRow1[0].ToString() + "\t" + dataRow1[1].ToString() + "\t\t" + dataRow1[2].ToString() + "\t" + dataRow1[3].ToString() + "\t" + dataRow1[4].ToString() + "\t" + dataRow1[5].ToString() + "\t";
}
} |