C#, web part for MOSS 2007:
Have my RadGrid defined and populated in the CreateChildControls() method. I am trying to use the ItemCommand event handler with limited success.
When I debug, the following events are not fired and caught in my ItemCommand() event handler method:
PerformInsertCommand
UpdateCommandName
Meanwhile, the following events are fired and caught in my ItemCommand() event handler method:
InitInsertCommandName
EditCommandName
It seems as though the "pre" action events are firing, but not the "post" action events.
Any ideas?
Have my RadGrid defined and populated in the CreateChildControls() method. I am trying to use the ItemCommand event handler with limited success.
When I debug, the following events are not fired and caught in my ItemCommand() event handler method:
PerformInsertCommand
UpdateCommandName
Meanwhile, the following events are fired and caught in my ItemCommand() event handler method:
InitInsertCommandName
EditCommandName
It seems as though the "pre" action events are firing, but not the "post" action events.
Any ideas?
7 Answers, 1 is accepted
0
Hi Andrew,
How the grid is bound in your case do you use NeedDataSource or DataSourceID? Please check if the ViewState is not turned off.
Kind regards,
Vlad
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
How the grid is bound in your case do you use NeedDataSource or DataSourceID? Please check if the ViewState is not turned off.
Kind regards,
Vlad
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Andrew
Top achievements
Rank 1
answered on 17 Apr 2008, 05:57 PM
i use the NeedDataSource event handler to populate.
0
Andrew
Top achievements
Rank 1
answered on 17 Apr 2008, 06:10 PM
... and RadGrid.EnableViewState = false;
0
Andrew
Top achievements
Rank 1
answered on 17 Apr 2008, 06:35 PM
I originally had EnableViewState set to false (which is by default), and had the same issues with event firing as detailed in the original post.
0
Vladimir
Top achievements
Rank 1
answered on 17 Apr 2008, 07:12 PM
Hi Andrew,
You need to turn on ViewState in order to avoid such problems.
Kind regards,
Vlad
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You need to turn on ViewState in order to avoid such problems.
Kind regards,
Vlad
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Andrew
Top achievements
Rank 1
answered on 21 Apr 2008, 01:48 PM
When I set .EnableViewState to true, I get the following error when I try to perform an Update to a grid row:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.]
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +353
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByID(ArrayList childState) +118
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +289
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Page.LoadAllState() +520
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3444
Server Error in '/' Application.
--------------------------------------------------------------------------------
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.]
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +353
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByID(ArrayList childState) +118
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +289
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +142
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +300
System.Web.UI.Page.LoadAllState() +520
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3444
0
Hi Andrew,
Can you send us an example which demonstrates this?
Sincerely yours,
Vlad
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Can you send us an example which demonstrates this?
Sincerely yours,
Vlad
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
