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

Issue with Ajax Control

24 Answers 163 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Pankaj
Top achievements
Rank 1
Pankaj asked on 20 Jan 2011, 09:09 AM
Hi,

I have ajax.net2 version 1.8.1.0. I want use to this on my asp.net 4.0 site. It work fine with other controls but when I use this with dropdown list I get JS error. Reason it convert ' to '. How can I fix this? 

<select name="ctl00$PageContentPlaceHolder$PageGrid$ctl01$ctl03$ctl01$PageDropDownList" onchange="javascript:setTimeout(&#39;AjaxNS.AR(\&#39;ctl00$PageContentPlaceHolder$PageGrid$ctl01$ctl03$ctl01$PageDropDownList\&#39;,\&#39;\&#39;, 'ctl00_PageContentPlaceHolder_RadAjaxManager1', event)&#39;, 0)" id="ctl00_PageContentPlaceHolder_PageGrid_ctl01_ctl03_ctl01_PageDropDownList" class="csa_textbox" style="width:40px;">

24 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 25 Jan 2011, 12:47 PM
Hi Pankaj,

Could you please elaborate a bit more on your application? What exactly scenario you are trying to achieve? Please provide us the RadAjax settings you have in the project and all related to the issue code behind so we could further research on the problem.

Best wishes,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Maria Ilieva
Telerik team
answered on 25 Jan 2011, 12:47 PM
Hi Pankaj,

Could you please elaborate a bit more on your application? What exactly scenario you are trying to achieve? Please provide us the RadAjax settings you have in the project and all related to the issue code behind so we could further research on the problem.

Best wishes,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
thomas
Top achievements
Rank 1
answered on 18 Feb 2011, 03:54 PM
At my company we have the exact same problem.
When the application is run in .Net 4 mode the AJAX output get scrambled for RadioButtonList.
The control is ajaxified in code behind (ajaxManager.AjaxSettings.AddAjaxSetting)
I reely hope there is some more info or solution on this problem.

Render on .Net 4
javascript:setTimeout(&#39;AjaxNS.AR(\&#39;

Render on .Net 2
javascript:setTimeout('AjaxNS.AR(\'
0
Maria Ilieva
Telerik team
answered on 23 Feb 2011, 01:20 PM
Hi,

Could you please let me know if the error appears when simple asp UpdatePanel is used instead of RadAjaxManager?
We are not aware of such generic issue with our RadAjax so more information on the scenario in which the problem persists could further help us investigate on the issue.


Best wishes,
Maria Ilieva
the Telerik team

Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
thomas
Top achievements
Rank 1
answered on 10 Mar 2011, 03:41 PM
Not abel to test that becouse we have one control updating another in differnt parts of the page.
I think the problem is related to the new Ajax Toolkit (new System.Web.Extensions.dll and AjaxControlToolkit.dll)
So the problem doesent seems to be with Frame Work 4 itself.
0
Rajiv Bannur
Top achievements
Rank 1
answered on 15 Mar 2011, 12:32 AM
Did we get any solution to this?

Render on .Net 4
javascript:setTimeout(&#39;AjaxNS.AR(\&#39;

Render on .Net 2
javascript:setTimeout('AjaxNS.AR(\'

We recently upgraded the website to .NET 4.0 and we do encounter these errors. I do appreciate your prompt reply.

Thanks,
-Rajiv
0
Maria Ilieva
Telerik team
answered on 15 Mar 2011, 03:56 PM
Hello Rajiv,

We are not aware of such an issue and were not able to replicate it on our side. Could you please open a regular support ticket and send us runnable version of your application and exact steps for replicating the issue. Thus e will be able to test it locally and do our best to help.


All the best,
Maria Ilieva
the Telerik team

Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Rajiv Bannur
Top achievements
Rank 1
answered on 15 Mar 2011, 11:13 PM
Maria I created a ticket  403657 and also uploaded a samle application, when you run it in IE(Enable Javascript debugging in advanced tab), you'll see an error stating

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; chromeframe/10.0.648.133; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; MS-RTC EA 2; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8; AskTbGOM2/5.9.1.14019)
Timestamp: Thu, 23 Dec 2010 23:13:02 UTC

Message: Expected ')'
Line: 78
Char: 62
Code: 0
URI: http://localhost:58337/Default.aspx

 

0
thomas
Top achievements
Rank 1
answered on 16 Mar 2011, 08:57 AM
Our solution was to change to an MS AJAX Panel and then it just worked.
Very strange buit that is how we solved the problem.
0
Ena
Top achievements
Rank 1
answered on 24 May 2011, 02:30 PM
I see lot of people on net have this problem with telerik controls. There is no solution because telerik team has not been able to reproduce the error. Some found the solution by getting rid of RadAjax on their page. The error can be reproduced, if the dropdown is in user control and there is need of javascript function on change of the dropdown.
The exact error is when telerik controls render the javascript onchange of some control, in some cases it uses setTimeout function. the actual javascript function (here AJAXNS.AR) is being passed as an argument to setTimeout function. and the third argument in function AjaxNS.AR is ID of RadAjaxManager. that is being passed in single quotes, which needs to be passed with backslash.
See the code below generated by Telerik controls  ('RadAjaxManager1' has single quote without backslash)
<select name="usercontrol:citydropdown" onchange="javascript:setTimeout('AjaxNS.AR(\'usercontrol:citydropdown\',\'\', 'RadAjaxManager1', event)', 0)" id="usercontrol_citydropdown"> </select>
I dont know, if it has some fix or not. Same code was working in older version of asp.net because telerik does not use setTimeout function there. Why telerik needs setTimeout function with 0 seconds with asp.net 4.0. This is BUG in the telerik RADAJAX control. It will be lot of work for replacing ajax in whole project. I am still looking for solution or workaround, if somebody has found so far ?

0
Rajiv Bannur
Top achievements
Rank 1
answered on 24 May 2011, 04:57 PM
We fixed this error by writing a custom HTML Encoder when the page renders its output. Microsoft thinks that this is a XSS Vulnerability that they have introduced in ASP.NET 4.
Excerpt from a ASP.NET Breaking Changes in 4

Extensible HTML, URL, and HTTP Header Encoding

In ASP.NET 4, you can create custom encoding routines for the following common text-encoding tasks:

  • HTML encoding.
  • URL encoding.
  • HTML attribute encoding.
  • Encoding outbound HTTP headers.

You can create a custom encoder by deriving from the new System.Web.Util.HttpEncoder type and then configuring ASP.NET to use the custom type in the httpRuntime section of the Web.config file, as shown in the following example:

<httpRuntime encoderType="Samples.MyCustomEncoder, Samples" /> 
0
Vishal Shukla
Top achievements
Rank 1
answered on 25 May 2011, 03:36 AM
Thanks Rajiv for reply. It is surprising that custom header encoding worked for you. I already tried overriding the htmlencoder class. It replaces anything other than the argument having single quote. It is like 'RadAjaxManager1' is inserted in client side html after htmlencoder call. If it solved your problem, that indicates, the source of your problem is different. Also, just fyi, my problem is not with &#39; single quote or &#39; they behaves same way in html rendering. The third argument in this function should be \'RadAjaxManager1\'
or \&#39;RadAjaxManager1\&#39;. Both will work. Problem is telerik missed backslash. In .net2 it works, because, setTimeout function is not being called, so there are no single quotes for setTimeout function and there is no need of backslash before quote for the third argument.
in .Net2 it is like
<select name="usercontrol:citydropdown" onchange="javascript:AjaxNS.AR('usercontrol:citydropdown','', 'RadAjaxManager1', event)" id="usercontrol_citydropdown"> </select>
 
In .Net4 it is like
<select name="usercontrol:citydropdown" onchange="javascript:setTimeout('AjaxNS.AR(\'usercontrol:citydropdown\',\'\', 'RadAjaxManager1', event)', 0)" id="usercontrol_citydropdown"> </select>


0
Rajiv Bannur
Top achievements
Rank 1
answered on 26 May 2011, 01:20 AM
Vishal - I think you should move your post to different section. This post was originally intended to override the &#39 which is used by the native rendering methods in .NET 4.0. The custom htmlencoder and registering in httpruntime section of web config should resolve this.

Thanks,
-Rajiv
0
Vishal Shukla
Top achievements
Rank 1
answered on 26 May 2011, 02:59 AM
This post was started on Jan 20,2011 by Pankaj, he had problem with single quote in 'ctl00_PageContentPlaceHolder_RadAjaxManager1'. &#39; was not the problem. It was wrong guess. single quote for this should be prefixed with backslash.
To confirm, you can just save the one line script in html page and render it. It works same way either you use &#39; or single quote.
See his code for <select name="ctl00$PageC ..... >, save this one line as html page and browse, replace &#39; with single quote and then browse, you will see same error.
I have same problem as Pankaj. And by overriding htmlencode, &#39; can be replaced with single quote with no problem. But that does not resolve our problem. Your problem may be different if it is resolved by replacing &#39; after overriding htmlencode.

This problem is because of the bug in code generation by Telerik controls and it needs replacing of ' by \'. This single quote is introduced in the code by telerik controls after htmlencode call on the page.



0
George
Top achievements
Rank 1
answered on 27 May 2011, 06:25 AM

 

Actually,  I have met almost the same problem. I have tried to solve it 
based on the above clarification. I found it failed. <BR>My main issue is 
that , whenThe DropDownlist in the user control try to fire another 
DropDownList control based on the RadAjaxManager control, the trigger event has 
not been triggered based on the "OnSelectedChangeIndex" event of 
fore-dropdownlist.<BR>This issue occurs after the application is upgraded from 
the .NET framework 2.0 to .NET framework 4.0.<BR><BR>I hope i can get urgent 
help for this issue.
0
Maria Ilieva
Telerik team
answered on 30 May 2011, 08:18 AM
Hello George,

Please ensure that you are using the correct dll for framework 4.0, Find attached a small application which works correctly on my side. Let me know what the difference in your case is.


Regards,
Maria Ilieva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Ena
Top achievements
Rank 1
answered on 30 May 2011, 08:38 PM

Hello Maria,
Thanks for looking into problem. You gave an example, which works fine in our case also. You have dropdown in default.aspx page. The problem is when you have dropdown in user control. and use the user control in default.aspx page. You will see setTimeout function which creates problem because of 'RadAjaxManager1' that should be \'RadAjaxManager1\'. sshot-4.png from George is also also missing back slash in 'ctl04_RadajaxManager1'.  it will be helpful, if you look further.

 

 

 

0
Maria Ilieva
Telerik team
answered on 02 Jun 2011, 12:24 PM
Hello Ena,

Please find attached the modified version of the previously provided application. The project uses UserControl however I'm still not able to observe the described behaviour. See the attachment and let me know if I'm missing something

Greetings,
Maria Ilieva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Ena
Top achievements
Rank 1
answered on 03 Jun 2011, 12:34 PM
Thanks Maria.
I think, this error comes on some combination. I could not find that combination. But the point i missed is, we have upgraded the application to use .net 4.0 and the radajax version upgraded to version 2.0. So, may be this error is when we are using  RadAjax.Net2 with .Net 4.0. In your example you are using Telerik.Web.UI. Is there any solution other than upgrading Radajax.Net2 to Telerik.web.ui. 
0
Maria Ilieva
Telerik team
answered on 08 Jun 2011, 02:09 PM
Hello Ena,

Note that the classic RadControls are no longer supported and they are not designed to work with .Net 4.0. I would suggest you to upgrade your application to the latest release of RadControls for ASP .Net Ajax, use the dll file for .Net 4.0 and verify if the issue still appears on your side.

Regards,
Maria Ilieva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Shark75
Top achievements
Rank 2
answered on 09 Jan 2014, 10:01 AM

Rajiv,


Would you mind posting the custom encoding class you wrote to get around this?



We've just upgraded to .NET 4.5.1 from 2.0 and get the same issue with the classic Telerik Ajax controls. We want to get .NET 4.5.1 working before moving our Telerik controls from Classic to ASP.NET AJAX and if there is some temporary step we can use like a custom encoder then that would be a help with our migration so we don't do everything at once.



Thanks in advance.



0
Maria Ilieva
Telerik team
answered on 13 Jan 2014, 02:24 PM
Hello Simon,

I would suggest you to open a separate support ticket and describe in details the exact issues you are currently facing after the upgrade. Thus we will be able to revise you specific case and advise you on possible fixes.

Regards,
Maria Ilieva
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Parthiban
Top achievements
Rank 1
answered on 22 Jun 2019, 09:23 AM
I have a RadAjax.Net2 in ajax panel version v2.0.50727 problem is user control dropdown autopostback issue after framework upgrade 3.5 to 4.7.2 in error “Uncaught SyntaxError: missing). I tried to solve in this issue on-change dopostback event argument. It is working. But drop down event fires other controls like textbox us read-only is value are comes null or empty issue. can you please help me solve this issue completely or any new dll support this issue.
0
Rumen
Telerik team
answered on 25 Jun 2019, 01:26 PM
Hi Parthiban,

RadAjax.Net2 is part of the RadControls for ASP.NET suite, which was discontinued in 2009 in favor of Telerik UI for ASP.NET AJAX.

This component is 10+ years old and neither supports .NET 3, nor 4.7.2.

My advice is plan migration to RadAjaxPanel from Telerik UI for ASP.NET AJAX (Telerik.Web.UI.dll assembly), which supports all .NET frameworks as well as all modern browsers:

Best Regards,

Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Ajax
Asked by
Pankaj
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
thomas
Top achievements
Rank 1
Rajiv Bannur
Top achievements
Rank 1
Ena
Top achievements
Rank 1
Vishal Shukla
Top achievements
Rank 1
George
Top achievements
Rank 1
Shark75
Top achievements
Rank 2
Parthiban
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or