strange error when using ajax

2 posts, 0 answers
  1. Albert Shenker
    Albert Shenker avatar
    588 posts
    Member since:
    Mar 2004

    Posted 06 Mar 2012 Link to this post

    I have the following setup as shown in the markup below. There is an ajaxified panel which contains an imagebutton and a hyperlink. Clicking on either of these opens a rad Window, which has a close handler. The close handler initiates the "click" event of a hidden button in order for me to be able to run some server-side code after the window closes. When I open the radwindow using the hyperlink, everything works as expected. When I do so using the image button, I get the following non-descript javascript error when the hidden button .click event is raised.

    Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405

    This error doesn not occur if I don't ajaxify the panel.

    I have tried to research this error and track down the cause, but to no avail. When I look at this in Fiddler, I notice the URL that fiddler errors on is .{my path}/javascript:void(0);. I don't know where the javascript:void(0); comes from... but I obviously include that in the Imagebutton PostbackUrl to prevent a postback when the imagebutton is clicked. I also don't know why this piece of the imagebutton declaration would have anything to do with this since the error occurs on the attempt to raise the hidden button's click event.

    Any Idea why the image button implementation wouldn't work, while the hyperlink does?


    <telerik:RadCodeBlock ID="rcb1" runat="server">
            <script language="javascript">
                function OpenDialog() {
                    var oWin = radopen('', ''); 
                function Refresh() {
                    $get('<%= tiReloader.ClientID %>').click();
    <asp:ScriptManager ID="MyScriptManager" runat="server" AsyncPostBackTimeout="7200"></asp:ScriptManager>
    <telerik:RadAjaxLoadingPanel id="lpGlobal" Runat="server" Transparency="18" CssClass="AjaxLoadingProgress"></telerik:RadAjaxLoadingPanel>
    <asp:Panel id="pnlT" runat="Server" height="400px">
        <asp:Button ID="tiReloader" runat="server" Text="Button" style="display:none;" />
        <asp:ImageButton id="ib" runat="Server" ImageUrl="~/global/images/icons/edit.png" AlternateText="Open Dialog from Image Button" ImageAlign="AbsMiddle" PostBackUrl="javascript:void(0);" OnClientClick="OpenDialog()" /><br/><br/>
        <asp:Hyperlink id="hl" runat="Server" target="_self" navigateurl="javascript:OpenDialog();" >Open Dialog from Hyperlink</asp:Hyperlink>

    In code-behind, I ajaxify the panel using an ajaxmanager which is part of my page base class:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        End Sub
        Private Sub SetAjaxManagerSettings()
            Me.AddAjaxSetting(pnlT, pnlT, lpGlobal, Unit.Percentage(100), Web.UI.UpdatePanelRenderMode.Block )
        End Sub
        Private Sub tiReloader_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles tiReloader.Click
        End Sub
    Public Sub AddAjaxSetting(ByVal initiatorControl As Control, ByVal updatedControl As Control, ByVal loadingPanel As RadAjaxLoadingPanel, ByVal updatePanelHeight As Unit, ByVal updatePanelRenderMode As UpdatePanelRenderMode)
                Dim ajaxManager As RadAjaxManager = Telerik.Web.UI.RadAjaxManager.GetCurrent(Me)
                If ajaxManager IsNot Nothing Then
                    If initiatorControl IsNot Nothing And updatedControl IsNot Nothing Then
                        Dim setting As AjaxSetting = New AjaxSetting
                        setting.AjaxControlID = initiatorControl.ID
                        Dim ajxUpdatedControl As New AjaxUpdatedControl()
                        ajxUpdatedControl.ControlID = updatedControl.ID
                        If loadingPanel IsNot Nothing Then
                            ajxUpdatedControl.LoadingPanelID = loadingPanel.ID
                        End If
                        ajxUpdatedControl.UpdatePanelRenderMode = updatePanelRenderMode
                        If Not updatePanelHeight.IsEmpty Then
                            ajxUpdatedControl.UpdatePanelHeight = updatePanelHeight
                        End If
                        Throw New Exception("The initiatorControl or updatedControl is NULL. Cannot add AjaxSetting.")
                    End If
                    Throw New Exception("Telerik RadAjaxManager not found on page. Set UseSharedAjaxManager property to True in Page_Init event or add a Telerik RadAjaxManager control to the page.")
                End If
            End Sub
  2. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 09 Mar 2012 Link to this post


    The presented error is a general MS Ajax issue which could be easily replicated with regular asp UpdatePanel instead of RadAjaxPanel with image button in several browsers. I would suggest you to fix the issue by ignoring the presented error using the following javascript:

    <script type="text/javascript">
    function EndRequestHandler(sender, args)
    if (args.get_error() != undefined && args.get_error().httpStatusCode == '500')
    var errorMessage = args.get_error().message;

    I hope this helps.

    Maria Ilieva
    the Telerik team
    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 their blog feed now.
Back to Top