This is a migrated thread and some comments may be shown as answers.

[Solved] Accessing Item

2 Answers 97 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Fábio
Top achievements
Rank 1
Fábio asked on 14 Nov 2010, 12:39 PM
Hi,

I have the following code for getting a cell content:

  private void Button_Click(object sender, RoutedEventArgs e)
 {
            Telerik.Windows.Controls.GridView.GridViewRow row = new Telerik.Windows.Controls.GridView.GridViewRow();

            string myData;

            myData = RadGridView1.Items[0].ToString(); } MyData is returning: "{ID=004211, Name=Jonh Test, Number=1}" What to do to access a specific value like "Name" ? Regards !

2 Answers, 1 is accepted

Sort by
0
Fábio
Top achievements
Rank 1
answered on 16 Nov 2010, 03:43 PM
Hello !?

Any help here ?
0
Accepted
Vanya Pavlova
Telerik team
answered on 16 Nov 2010, 04:17 PM
Hi Fábio,

 
Use the following code to achieve desired result (assume that the Name is a property of an Employee object):

private void RadButton_Click(object sender, RoutedEventArgs e)
       {
           var myData = (this.RadGridView1.Items[0] as Employee).Name;
           MessageBox.Show(myData.ToString());
       }


 

Kind regards,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Fábio
Top achievements
Rank 1
Answers by
Fábio
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or