views:

36

answers:

1

Hai am using telerik wpf grid

in grid selection change event am getting the selected row values. the problem is the values are as object.

object myData = radGridView.SelectedItem;

the object myData contains the row values. but i don know how to get values from the myData object

A: 

If you are assigning(or Binding) Collection of MyType to ItemsSource then you will get SelectedItem as object of MyType. All you need to do is

MyType myData = radGridView.SelectedItem as MyType;

and then you can read the values form myData object. Hope it helps!!

viky
hai vikyi did like this, but it returns null. why?? Array []myData = radGridView.SelectedItem as Array[];
deep
as operator returns null upon invalid casting. Put a breakpoint on the line and examine the type when debugger stops there.
Chansik Im
in tat object one value is string, one is double.
deep
In your case, you are assigning array of MyType as ItemsSource, so you need to cast the selected item to MyType not to Array of Mytype
viky
sorry viki .i cant get u.. can u tell me detailed... if u have can look at the simple sample. http://cid-08ec3041618e8ee4.skydrive.live.com/self.aspx/.SharedFavorites/wpfgridview.rar
deep
hey thanks all,. i got nu using the get set for the object
deep