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

Formatting grid rows doesn't work after upgrade to 2015 1

1 Answer 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 1
Erik asked on 27 Feb 2015, 06:11 AM
Dear friends,

I have an issue after upgrading my web forms project to the new version (2015 1 225) of THE UI for ASP.NET AJAX. And it is that the code, which works ok in older versions, does not work anymore in the new version...? The error, which is produced within executing of the bellow shown methods is: "CANNOT FIND A CELL BOUND TO COLUMN...". The code:

//formating data grid
protected void RadGrid10_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem dataItem = (GridDataItem)e.Item;
        dataItem.BackColor = System.Drawing.Color.FromName(dataItem["M"].Text); ;
        dataItem.Font.Size = Convert.ToInt16(dataItem["L"].Text);
        dataItem.Font.Bold = dataItem["N"].Text == "true" ? true : false;
        dataItem.Font.Italic = true;
        dataItem.BorderStyle = BorderStyle.Solid;
        dataItem.BorderWidth = Unit.Pixel(1);
        dataItem.BorderColor = System.Drawing.Color.Black;
    }
}
//export to pdf
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
    if ((String)Session["partnerHP"] != "-9999")
    {
        foreach (GridDataItem item in RadGrid10.Items)
        {
            item.Style["background-color"] = item["M"].Text;
            item.Style["font-family"] = "Arial Unicode MS";
        }
        RadGrid10.ExportSettings.Pdf.Title = hf.Value.ToString();
        RadGrid10.ExportSettings.FileName = hf.Value;
        GridHeaderItem headerItem = RadGrid10.MasterTableView.GetItems(GridItemType.Header)[0] as GridHeaderItem;
        headerItem.Visible = false;
        RadGrid10.MasterTableView.ExportToPdf();
    }
    else
    {
        RadWindowManager1.RadAlert("Za izpis v pdf morajo biti prikazane podrobnosti!", 400, 150, null, null);
    }
}



P.S. Grid is dinamicaly populated using stored procedure which just returns data rows using plain select statement. Data binding is done in "On need data source" from the grid.
And also please see attached file for details. I would appreciate any suggestions.

Regards,
Erik D.

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 03 Mar 2015, 09:31 PM
Hello,

The provided code looks correct and it should work without problems with the new version. Would you specify which was the previous version that you used before migrating to Q1 2015? Also confirm that a column with UniqueName="M" exists and this column is visible(its Display property is not set to false).

Regards,
Pavlina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Erik
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or