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

How to get the selected value in RadGrid1_SelectedIndexChanged using SelectedValues("......")

1 Answer 213 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ervin
Top achievements
Rank 1
ervin asked on 21 Jun 2011, 08:31 PM
Instead of using SelectedValue and a predefined column as DataKeyName, how can I get the other selected values in the other columns like;

bHasChildren = IIf(RadGrid1.SelectedValues("HasChild").ToString() = "Y", True, False)

SelectedValues("HasChild") does not work here...
"HasChild" is another column and I would like to get the cell in the intersection of this column and the row, when one clicks the row.

Thanks,
Ervin

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 Jun 2011, 08:32 AM
Hello Ervin,

SelectedValue property determines the data key value of the selected row in a RadGrid control. One suggestion to access the column "HasChild" is by setting the "DataKeyNames" for the RadGrid.

Also you can access the column using ColumnUniqueName property as shown below.

C#:
protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e)
{
        var dataitem = RadGrid1.SelectedItems[0] as GridDataItem;
        var name = dataitem["HasChild"].Text;
}

Thanks,
Princy.
Tags
Grid
Asked by
ervin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or