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

Data not binding to GridBoundColumn

2 Answers 213 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Larry
Top achievements
Rank 1
Larry asked on 12 Jun 2014, 02:50 PM

I recently had a project upgraded from Telerik 2009.2.702.35 to 2014.1.403.40.  In my RadGrid_ItemDataBound event, I get the values from two of my bound columns and construct a string that I assign to a hyperlink column.  Prior to the upgrade, my code worked (and still works in an unconverted version).  After the upgrade, my code doesn't seem to work any longer.  It looks like one of my bound columns isn't getting assigned a value and contains the blank value default text "&nbsp"  now and I'm not sure why. When I interrogate the item row variable, I can see the data values in the ItemArray collection, but it doesn't seem to be available to me as a table column value when I try to extract it using the column's UniqueName.   In the code snippet below, the second value called "NIIN" is there, but the first value called "PIIN" ,isn't( I've verified that the SQL code that I'm using is extracting a value).  I can't explain why some of my bound columns don't contain data any longer and other columns do.    Any help that you can provide would be appreciated.

protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
       if (e.Item is GridDataItem)
         {
            if (e.Item.OwnerTableView.Name == "LTC_ITEM")
                {
                  GridDataItem item = (GridDataItem)e.Item;
                  HyperLink hl = (HyperLink)item["LinkCol"].Controls[0];
                  if (hl != null)
                    {
                        string link = "itemdetail.aspx?PIIN=" + item["PIIN"].Text + "&NIIN=" + item["NIIN"].Text; ;
                        hl.NavigateUrl = link;
                    }

                    LTCHeader header = (LTCHeader)FormView1.DataItem;
                    if ((header != null) && (header.IsTerminated()))
                    {
                        GridDataItem di = (GridDataItem)e.Item;
                        DataBoundControl minQtyPerOrder = (DataBoundControl)di["MIN_QTY_PER_ORDER"].Controls[0];
                        DataBoundControl maxQtyPerOrder = (DataBoundControl)di["MAX_QTY_PER_ORDER"].Controls[0];
                        DataBoundControl maxQtyAvail = (DataBoundControl)di["MAX_QTY_AVAIL"].Controls[0];
                        minQtyPerOrder.Enabled = false;
                        maxQtyPerOrder.Enabled = false;
                        maxQtyAvail.Enabled = false;
                    }
                 }
           }    
     }

2 Answers, 1 is accepted

Sort by
0
Larry
Top achievements
Rank 1
answered on 12 Jun 2014, 03:43 PM
I found the answer to my problem.  It seems as though in version 2009.2.701.35 I could bind data to a column with the visible property set to "false".  In version 2014.1.403.40, that doesn't seem to be the case.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 13 Jun 2014, 12:34 PM
Hi Larry,

Please take a look at this forum which discuss about the change made in Visible and Display property of grid.
http://www.telerik.com/forums/breaking-change-hidden-column-cell-text-is-not-persisted-in-viewstate

Thanks,
Shinu
Tags
Grid
Asked by
Larry
Top achievements
Rank 1
Answers by
Larry
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or