Santiago Botero
Top achievements
Rank 1
Santiago Botero
asked on 01 Feb 2010, 04:17 PM
Hi,
I'm using the telerik Rad controls for ASP .NET AJAX version 2009_3_1103
I have two RadComboBox with a RadTreeView each one.
When I check a node in the first TreeView (in the first ComboBox) the second treeview is rebinding with a new information.
The all is ajaxifing with a RadAJAXManager.
The thing is that this work fine when I check one and two times but on the third time the following error is occurring!
The error is:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Best regards.
I'm using the telerik Rad controls for ASP .NET AJAX version 2009_3_1103
I have two RadComboBox with a RadTreeView each one.
When I check a node in the first TreeView (in the first ComboBox) the second treeview is rebinding with a new information.
The all is ajaxifing with a RadAJAXManager.
The thing is that this work fine when I check one and two times but on the third time the following error is occurring!
The error is:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Best regards.
5 Answers, 1 is accepted
0
Hello Santiago Botero,
I suppose that the information that is post to the server contains html tags for example <script> which breaks the page validation. .NET framework thinks that this is a security risk hence the exception.
If you know what you are doing you can disable the request validation by setting the
ValidateRequest="false" at the @Page directive.
Regards,
Veskoni
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
I suppose that the information that is post to the server contains html tags for example <script> which breaks the page validation. .NET framework thinks that this is a security risk hence the exception.
If you know what you are doing you can disable the request validation by setting the
ValidateRequest="false" at the @Page directive.
Regards,
Veskoni
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Santiago Botero
Top achievements
Rank 1
answered on 04 Feb 2010, 09:52 AM
Hello Veskoni,
That is exatly that I did.
But I'm looking for another solution because this solution is compromising the security of my application.
The peculiar thing is both, that I have the exactly configuration of controls (two RadComboBox whith a RadTreeView each one) in another page (more complexe, with more JavaScript) where I haven't this error, and that the error is occuring only on the third click (NodeCheck).
I also tested with "RegisterForEventValidation" but this way didn't work.
I also tried with removing the controls from AjaxSettings, so the following lines :
And That worked, but with the obviously undesiable effect to PostBack the entier Page.
So I thing is a bug with the RadAjaxManager, maybe.
Regards,
Santiago Botero.
That is exatly that I did.
But I'm looking for another solution because this solution is compromising the security of my application.
The peculiar thing is both, that I have the exactly configuration of controls (two RadComboBox whith a RadTreeView each one) in another page (more complexe, with more JavaScript) where I haven't this error, and that the error is occuring only on the third click (NodeCheck).
I also tested with "RegisterForEventValidation" but this way didn't work.
I also tried with removing the controls from AjaxSettings, so the following lines :
| <telerik:AjaxSetting AjaxControlID="RadTreeView1" EventName="NodeCheck"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="RadComboBox2" /> |
| <telerik:AjaxUpdatedControl ControlID="RadTreeView2" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
And That worked, but with the obviously undesiable effect to PostBack the entier Page.
So I thing is a bug with the RadAjaxManager, maybe.
Regards,
Santiago Botero.
0
Hello Santiago Botero,
Kind regards,
Simon
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Perhaps there is indeed a bug in RadAjaxManager, RadComboBox or RadTreeView. However we will need to first reproduce it.
Can you please provide me with the markup of the RadComboBox/RadTreeView and any related JavaScript and/or server-side code? Please try using dummy data as well, i.e. remove all dependencies to an external data source.
Kind regards,
Simon
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Santiago Botero
Top achievements
Rank 1
answered on 04 Feb 2010, 11:16 AM
Hello Simon,
The following is the markup, side-server code and JavaScript enrolled with the behaviour of Two RadComboBox and Two RadTreeView.
Markup :
gereralActions.js:
server-side code:
I hope this can help!!
Regards
Santiago BOTERO.
The following is the markup, side-server code and JavaScript enrolled with the behaviour of Two RadComboBox and Two RadTreeView.
Markup :
| <telerik:RadScriptManager ID="RadScriptManager" Runat="server" EnableViewState="true"> |
| </telerik:RadScriptManager> |
| <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default" EnableViewState="true"> |
| </telerik:RadAjaxLoadingPanel> |
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableViewState="true"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="FleetTree" EventName="NodeCheck"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="VehicleFilter" /> |
| <telerik:AjaxUpdatedControl ControlID="VehicleTree" /> |
| <telerik:AjaxUpdatedControl ControlID="FleetTree" LoadingPanelID="RadAjaxLoadingPanel1"/> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManager> |
| <div align="center" style="width: 1000px"> |
| <div id="Filter_Search" align="left" style="margin-top: 10px"> |
| <table> |
| <tr> |
| <td> |
| <telerik:RadComboBox |
| ID="FleetFilter" EnableViewState="true" |
| EmptyMessage="<%$ Resources:Dotmobil_Client, Option_Temperature_Your_Fleets%>" |
| runat="server" AutoPostBack="True"> |
| <ItemTemplate> |
| <div onclick="StopPropagation(event)"> |
| <telerik:RadTreeView ID="FleetTree" runat="server" |
| CheckBoxes="true" EnableViewState="true" |
| OnNodeCheck="FleetFilter_NodeCheck" |
| CheckChildNodes="true" |
| TriStateCheckBoxes="true"> |
| </telerik:RadTreeView> |
| </div> |
| </ItemTemplate> |
| <Items> |
| <telerik:RadComboBoxItem /> |
| </Items> |
| </telerik:RadComboBox> |
| </td> |
| <td> |
| <telerik:RadComboBox |
| ID="VehicleFilter" EnableViewState="true" |
| EmptyMessage="<%$ Resources:Dotmobil_Client, Option_Temperature_Vos_Vehicles%>" |
| runat="server"> |
| <ItemTemplate> |
| <div onclick="StopPropagation(event)"> |
| <telerik:RadTreeView ID="VehicleTree" runat="server" |
| CheckBoxes="true" EnableViewState="true" |
| CheckChildNodes="true" |
| TriStateCheckBoxes="true"> |
| </telerik:RadTreeView> |
| </div> |
| </ItemTemplate> |
| <Items> |
| <telerik:RadComboBoxItem /> |
| </Items> |
| </telerik:RadComboBox> |
| </td> |
| </tr> |
| <table> |
| </div> |
| </div> |
| <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
| <script src="../../Options/Js/generalActions.js" type="text/javascript"> |
| </script> |
| </telerik:RadCodeBlock> |
gereralActions.js:
| function StopPropagation(e) |
| { |
| //cancel bubbling |
| e.cancelBubble = true; |
| if (e.stopPropagation) |
| { |
| e.stopPropagation(); |
| } |
| } |
server-side code:
| protected void Page_Load(object sender, EventArgs e) |
| { |
| try |
| { |
| if (!IsPostBack) |
| { |
| RadTreeView VehicleTree = (RadTreeView)VehicleFilter.Items[0].FindControl("VehicleTree"); |
| RadTreeView FleetTree = (RadTreeView)FleetFilter.Items[0].FindControl("FleetTree"); |
| //This load the information in the treeViews |
| managerClient.initializeVehiclesClientInTreeView(VehicleTree, ClientID, SourceFileClient); |
| managerClient.initializeFleetsClientInTreeView(FleetTree, ClientID, SourceFileClient); } |
| } |
| catch (Exception ex) |
| { |
| //TODO : manage error |
| throw ex; |
| } |
| } |
| //I tried with that but any result!! |
| protected override void Render(HtmlTextWriter writer) |
| { |
| /* RadTreeView FleetTree = (RadTreeView)FleetFilter.Items[0].FindControl("FleetTree"); |
| Page.ClientScript.RegisterForEventValidation(FleetTree); |
| */ |
| base.Render(writer); |
| } |
| protected void FleetFilter_NodeCheck(object sender, RadTreeNodeEventArgs e) |
| { |
| try |
| { |
| Load_Vehicle_on_ComboBox(); |
| } |
| catch (Exception ex) |
| { |
| //TODO ECRIRE LOG |
| throw ex; |
| } |
| } |
| private void Load_Vehicle_on_ComboBox() |
| { |
| RadTreeView VehicleTree = (RadTreeView)VehicleFilter.Items[0].FindControl("VehicleTree"); |
| RadTreeView FleetTree = (RadTreeView)FleetFilter.Items[0].FindControl("FleetTree"); |
| Int32[] selected_Fleets = new Int32[FleetTree.CheckedNodes.Count]; |
| int i = 0; |
| foreach (RadTreeNode node in FleetTree.CheckedNodes) |
| { |
| if (node.Checked) |
| { |
| if (node.Value != "") |
| { |
| selected_Fleets[i] = Convert.ToInt32(node.Value); |
| i++; |
| } |
| } |
| } |
| VehicleTree.Nodes.Clear(); |
| if (i > 0) |
| { |
| managerClient.initializeVehiclesClientInTreeView(VehicleTree, selected_Fleets, ClientID, SourceFileClient); |
| } |
| else |
| { |
| managerClient.initializeVehiclesClientInTreeView(VehicleTree, ClientID, SourceFileClient); |
| } |
| VehicleTree.DataBind(); |
| } |
I hope this can help!!
Regards
Santiago BOTERO.
0
Hello Santiago Botero,
Everything seems correct to me. What happens if you use static nodes of the trees (instead of nodes from the database)?
Best wishes,
Veskoni
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Everything seems correct to me. What happens if you use static nodes of the trees (instead of nodes from the database)?
Best wishes,
Veskoni
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.