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

Unable to cast object of type 'Telerik.Windows.Controls.GridViewDynamicHyperlinkColumn' to type 'Telerik.Windows.Controls.GridViewDataColumn'.

1 Answer 430 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Louis Bouchard
Top achievements
Rank 1
Louis Bouchard asked on 11 Apr 2011, 09:03 PM
Thank you for the RadGridViewSettings.cs file.  Every thing work #1 except when I sort on a GridViewDynamicHyperlinkColumn and save it.

See error message in attachement.

Error at this line (setting.PropertyName = ((GridViewDataColumn)d.Column).GetDataMemberName();) :

foreach (ColumnSortDescriptor d in grid.SortDescriptors.OfType<ColumnSortDescriptor>())
{
    SortSetting setting = new SortSetting();
    setting.PropertyName = ((GridViewDataColumn)d.Column).GetDataMemberName();
    setting.SortDirection = d.SortDirection;
    Settings.SortSettings.Add(setting);
}

Any idea ?

{System.InvalidCastException: Impossible d'effectuer un cast de l'objet de type 'Telerik.Windows.Controls.GridViewDynamicHyperlinkColumn' en type 'Telerik.Windows.Controls.GridViewDataColumn'.
   à mesespacesclos.RadGridViewSettings.SaveState()
   à mesespacesclos.RadGridViewSettings.grid_Unloaded(Object sender, RoutedEventArgs e)
   à MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   à MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)}

1 Answer, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 11 Apr 2011, 09:10 PM
Hello Louis Bouchard,

 GridViewDynamicHyperlinkColumn descends from GridViewBoundColumnBase, not GridViewDataColumn.

Kind regards,
Yavor Georgiev
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
Louis Bouchard
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Share this question
or