Issue with Ajax Control

23 posts, 0 answers
  1. Pankaj
    Pankaj avatar
    1 posts
    Member since:
    Jan 2011

    Posted 20 Jan 2011 Link to this post

    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;">
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 25 Jan 2011 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 25 Jan 2011 Link to this post

    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.
  5. thomas
    thomas avatar
    3 posts
    Member since:
    Jan 2007

    Posted 18 Feb 2011 Link to this post

    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(\'
  6. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 23 Feb 2011 Link to this post

    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!
  7. thomas
    thomas avatar
    3 posts
    Member since:
    Jan 2007

    Posted 10 Mar 2011 Link to this post

    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.
  8. Rajiv Bannur
    Rajiv  Bannur avatar
    5 posts
    Member since:
    Nov 2008

    Posted 14 Mar 2011 Link to this post

    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
  9. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 15 Mar 2011 Link to this post

    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!
  10. Rajiv Bannur
    Rajiv  Bannur avatar
    5 posts
    Member since:
    Nov 2008

    Posted 15 Mar 2011 Link to this post

    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

     

  11. thomas
    thomas avatar
    3 posts
    Member since:
    Jan 2007

    Posted 16 Mar 2011 Link to this post

    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.
  12. Ena
    Ena avatar
    4 posts
    Member since:
    May 2011

    Posted 24 May 2011 Link to this post

    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 ?

  13. Rajiv Bannur
    Rajiv  Bannur avatar
    5 posts
    Member since:
    Nov 2008

    Posted 24 May 2011 Link to this post

    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" /> 
  14. Vishal Shukla
    Vishal Shukla avatar
    3 posts
    Member since:
    Sep 2005

    Posted 24 May 2011 Link to this post

    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>


  15. Rajiv Bannur
    Rajiv  Bannur avatar
    5 posts
    Member since:
    Nov 2008

    Posted 25 May 2011 Link to this post

    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
  16. Vishal Shukla
    Vishal Shukla avatar
    3 posts
    Member since:
    Sep 2005

    Posted 25 May 2011 Link to this post

    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.



  17. George
    George avatar
    1 posts
    Member since:
    Aug 2008

    Posted 27 May 2011 Link to this post

     

    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.
  18. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 30 May 2011 Link to this post

    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.

  19. Ena
    Ena avatar
    4 posts
    Member since:
    May 2011

    Posted 30 May 2011 Link to this post

    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.

     

     

     

  20. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 02 Jun 2011 Link to this post

    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.

  21. Ena
    Ena avatar
    4 posts
    Member since:
    May 2011

    Posted 03 Jun 2011 Link to this post

    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. 
  22. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 08 Jun 2011 Link to this post

    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.

  23. Shark75
    Shark75 avatar
    32 posts
    Member since:
    Apr 2007

    Posted 09 Jan 2014 Link to this post

    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.



  24. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 13 Jan 2014 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017