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

Server Error when sorting from server-side

3 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Forrest
Top achievements
Rank 1
Forrest asked on 21 Jul 2008, 06:53 PM
Greetings,
  I have a RadGrid within a CompositeControl (along with a couple RadMenus and some other controls). I store a user's column visibility and sort preferences serverside and manually add the columns and sortexpression when a grid is loaded. The error I am getting is:

Unable to cast object of type 'Telerik.Web.UI.GridImageButton' to type 'System.Web.UI.WebControls.Button'.

which occurs Only when I add my own sortexpression to the mastertableview during Grid.Init (after all the columns have been added). If I comment out the
Grid.MasterTableView.SortExpressions.AddSortExpression(sortExp);
then everything works as expected, but I don't get my sort, of course.

I have tried setting Col.ShowSortIcon to false but that did not change anything. I have also played with different values for Col.HeaderButtonType, also without change.

Any insight would be greatly appreciated.

Thanks,
 - Forrest

3 Answers, 1 is accepted

Sort by
0
Forrest
Top achievements
Rank 1
answered on 22 Jul 2008, 06:08 PM
Bump..

0
Nikita Gourme
Top achievements
Rank 1
answered on 24 Jul 2008, 08:29 AM
I am not familiar with your composite control implementation, however it seems to me that the sort icon displayed in the column header is attempted to be cast to Button while it is actually GridImageButton. I read about the CSS sprite buttons for the grid elements here and this might be connected to the matter. Check your code for any explicit casts to Button for grid images, this might give you some clues.

Nikita
0
Forrest
Top achievements
Rank 1
answered on 24 Jul 2008, 03:27 PM
Thank you very much for the reply.

Unfortunately, I never touch anything regarding rendering in the header columns of the grid. But that does give me an idea on how to approach this, thanks. I'll let you know how I fare.

Tags
Grid
Asked by
Forrest
Top achievements
Rank 1
Answers by
Forrest
Top achievements
Rank 1
Nikita Gourme
Top achievements
Rank 1
Share this question
or