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

errors when migrating from Q1 SP2 to Q2

1 Answer 103 Views
GridView
This is a migrated thread and some comments may be shown as answers.
shortie
Top achievements
Rank 2
shortie asked on 19 Jul 2010, 06:46 AM
We got these errors when trying to upgrade our Q1 SP2 projects:

1. no 'VisualElement' property
GridViewRowInfo r = radGridView.Rows[i];
r.VisualElement.ForeColor = System.Drawing.Color.Red;

2. no 'CellElement' property
GridViewCellInfo gvci = radGridView.Rows[i].Cells[0];
GridCheckBoxCellElement gcbce = (GridCheckBoxCellElement)gvci.CellElement;

3. no 'Owner' property
var col = (GridViewDataColumn)cell.ColumnInfo;
col.OwnerTemplate.Owner;

Please help us to fix the above errors. Thanks in advance.

BR/shortie

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 20 Jul 2010, 06:36 AM
Hello ChunChang,

Thank you for your feedback:

1. We removed the VisualElement property because many of our customers used it in a wrong way. This property was safe to be accessed only when handling the RowFormatting event. In fact you can use it only for testing purposes. You should handle RowFormatting event instead. For example:

void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e)
{
    if ((int)e.RowElement.RowInfo.Cells["ID"].Value > 10)
    {
        e.RowElement.ForeColor = Color.Red;
    }
    else
    {
        e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local);
    }
}

2. The same applies for the CellElement property. However, you can still get the cell and row elements by using GridTableElement.GetRowElement and GetCellElement methods:

GridRowElement rowElement = this.radGridView1.TableElement.GetRowElement(this.radGridView1.Rows[5]);
GridCellElement cellElement = this.radGridView1.TableElement.GetCellElement(this.radGridView1.Rows[5], this.radGridView1.Columns["Name"]);
//...

3. In the new RadGridView the data layer is a separate component that could be used without a UI. It doesn't know about the RadGridView control at all. That's why we removed the Owner property. Please describe the situation where you need access to the control. We will try to find a solution.

I am looking forward to your reply.

 

Regards,
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
shortie
Top achievements
Rank 2
Answers by
Jack
Telerik team
Share this question
or