Eamon
asked on
Get Selected Item wpf datagrid
WPF This should be really simple but I just can't find it. New to WPF so sorry about this.
I have a datagrid and just want to click on a cell and either show its contents in a text box or popup a messagebox with the value.
Thought it should be selectedvalue or selecteditem or something like that but have had no luck sofar.
Thanks
Cnat even find WPF zone to put this question in
I have a datagrid and just want to click on a cell and either show its contents in a text box or popup a messagebox with the value.
Thought it should be selectedvalue or selecteditem or something like that but have had no luck sofar.
Thanks
Cnat even find WPF zone to put this question in
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Eamon,
Here is how a solution is provided to your requirement.
http://stackoverflow.com/questions/3774140/wpf-datagrid-datatable-large-number-of-rows
Here is how a solution is provided to your requirement.
http://stackoverflow.com/questions/3774140/wpf-datagrid-datatable-large-number-of-rows
ASKER
I ended up using this.
int i = dgGrn.Items.IndexOf(dgGrn. SelectedIt em);
var rowData = dgGrn.Items[i] as DataRowView;
ret = rowData[ColName].ToString( );
int i = dgGrn.Items.IndexOf(dgGrn.
var rowData = dgGrn.Items[i] as DataRowView;
ret = rowData[ColName].ToString(
ASKER
cmd.ExecuteNonQuery();
SqlDataAdapter daPopGRN = new SqlDataAdapter(cmd);
DataSet dsPopGRN = new DataSet();
daPopGRN.Fill(dsPopGRN, "GRN");
dgGrn.ItemsSource = dsPopGRN.Tables[0].Default