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

Getting a column value without using UniqueName

2 Answers 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
vincent
Top achievements
Rank 1
vincent asked on 27 Sep 2011, 07:09 PM
I have an array of several rows and columns bound to a radGrid but I am only displaying a few of the columns which is working fine so far.

For each row, I am displaying a button where I will append it with a querystring of some values.

Unfortunately, some of the values which I intend to include in the querystring are not among the display columns, eg: columnG

I tried declaring a new column in the aspx file with UnqueName ColumnG but it does not seem to be working.

Question is , how do I get this column value in itemDataBound without using UniqueName ?

Thanks



2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Sep 2011, 05:23 AM
Hello Vincent,

You can access the hidden columns through DataRowView. Here is the sample code.
C#:
protected void grid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
 {
     if (e.Item is GridDataItem)
     {  
        string s = ((DataRowView)e.Item.DataItem)["ColumnG"].ToString();
     }
 }

Thanks,
Shinu.
0
vincent
Top achievements
Rank 1
answered on 28 Sep 2011, 10:55 AM
Wow, fantastic. Glad that it can be done this way.

Many thanks to you, Shinu
Tags
Grid
Asked by
vincent
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
vincent
Top achievements
Rank 1
Share this question
or