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

RadGrid sorting in user control

5 Answers 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sean Severson
Top achievements
Rank 1
Sean Severson asked on 06 Feb 2012, 08:00 PM
I have a user control containing a radGrid.  The RadGrid supports sorting.  The user control is added to my web form via code.  I am able to sort the grid one time.  Subsequent sorts cause the following error to occur:

An error has occurred because a control with id 'ctl00$ContentPlaceHolder1$pnlStatesInfo$i0$i0$ctl01$rgClassCode$ctl00$ctl02$ctl00$ctl01' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.

The control identified in the error is the control that displays the sort ascending and sort descending icons.  My user controls are recreated and reloaded at each postback.  Is there a way to declare a static id for this control or do I need to be storing my created user controls in viewstate and not recreating them on each postback?  is there some other way to handle this?

Thanks!

Sean M. Severson

5 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 09 Feb 2012, 11:52 AM
Hello Sean,

Note that the RadControls could work properly only with ClientIDMode set to AutoID. However the presented error is rather strange and should not appear ion scenarios like yours. Could I kindly ask you to open a regular support ticket and send us runnable version of your application which demonstrates the presented error.
Thus we will be able to debug it locally and do our best to isolate the root cause of the problem and provide proper solution.


Kind regards,
Maria Ilieva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Sean Severson
Top achievements
Rank 1
answered on 15 Feb 2012, 07:35 PM
Maria,

Turns out that my issue was having ViewStateMode = "Enabled" set on the RadGrid.  Setting the ViewStateMode property to "Disabled" eliminated the error I reported and the grid now sorts as required.

Sean M. Severson
0
Maria Ilieva
Telerik team
answered on 16 Feb 2012, 02:57 PM
Hello,

I'm glad that you have mentioned to fix the issue.
Note that for most of the RadGrid's features like paging, sorting,. filtering ect. require enabled ViewState if the RadGrid control in order to work properly.

Regards,
Maria Ilieva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Sean Severson
Top achievements
Rank 1
answered on 16 Feb 2012, 03:11 PM
Maria,

I'm not sure if my issue was related to dynamically creating and loading the user control (contaiing the radgrid) in the codebehind?  The sorting works fine now.

Sean M. Severson
0
M
Top achievements
Rank 1
answered on 07 Nov 2013, 05:01 AM
Thanx. ViewStateMode = 'Disabled' worked for me.
Tags
Grid
Asked by
Sean Severson
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Sean Severson
Top achievements
Rank 1
M
Top achievements
Rank 1
Share this question
or