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

How to get a value from selected row

2 Answers 147 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Olo
Top achievements
Rank 1
Olo asked on 08 Dec 2008, 12:15 PM
Hello,
my problem is:
I have a grid (rgListMainGridBase.SelectedItems[0] as GridDataItem)(rgListMainGridBase.MasterTableView),  I selected a row. And i want to get a value from cells ["House"].
How can I do that (c#)?
Thx

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 08 Dec 2008, 02:53 PM
Hello Olo,

Test the following approach:
protected void Button1_Click(object sender, EventArgs e) 
    if (rgListMainGridBase.SelectedItems.Count > 0) 
    { 
        string myText = (rgListMainGridBase.SelectedItems[0] as GridDataItem)["House"].Text; 
    } 

or

protected void Button1_Click(object sender, EventArgs e) 
    if (rgListMainGridBase.SelectedItems.Count > 0) 
    { 
        Hashtable table = new Hashtable(); 
        (rgListMainGridBase.SelectedItems[0] as GridDataItem).ExtractValues(table); 
        string myText = table["House"].ToString(); 
    } 

Let us know whether this helps.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Olo
Top achievements
Rank 1
answered on 22 Dec 2008, 09:10 AM
It works very good. Thx a lot:)
Tags
Grid
Asked by
Olo
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Olo
Top achievements
Rank 1
Share this question
or