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

can't get the value of cell

1 Answer 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kanat
Top achievements
Rank 1
Kanat asked on 09 Feb 2011, 11:14 AM

Hi, 

I need to get the value of column, and was trying to get it as in the following thread:

http://www.telerik.com/community/forums/aspnet-ajax/grid/how-fetch-column-value-from-detailtables.aspx

protected void RG_SearchResult_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
...
             if (e.CommandName == "History")
             {
                  if (e.Item.OwnerTableView.Name == "Level2")   //check with name of DetailTableView <br>                
                  {
                              GridDataItem item = (GridDataItem)e.Item;
                              foreach (GridDataItem childItem in item.ChildItem.NestedTableViews[0].Items) 
                              {
                                      string value= childItem["PropCode"].Text;
                             }
                
...

But I here - item.ChildItem.NestedTableViews[0].Items get error - Object reference not set to an instance of an object.

What I am doing wrong ?

1 Answer, 1 is accepted

Sort by
0
Kanat
Top achievements
Rank 1
answered on 09 Feb 2011, 11:27 AM

[RESOLVED]

I got the desired value as:

GridDataItem item = (GridDataItem)e.Item;
string itemValue = item["PropCode"].Text;

Tags
Grid
Asked by
Kanat
Top achievements
Rank 1
Answers by
Kanat
Top achievements
Rank 1
Share this question
or