Show Error after OnAjaxRequest

15 posts, 0 answers
  1. ALEX
    ALEX avatar
    61 posts
    Member since:
    Feb 2011

    Posted 20 Feb 2012 Link to this post

    Hi Team,

              I'm facing unknow error after OnAjaxRequest trigger.
    Error is : 126|updatePanel|ctl00_ContentPlaceHolder1_Lines_C__radGrid_ctl00_ctl05_EditFormControl__radAjManagersSU||
    At my page i didn't use asp:UpdatePanel, why i saw this error.

               Please help to me.

    Here is code.

    <telerik:RadScriptBlock ID="radScriptBlock" runat="server">
        <script type="text/javascript" language="javascript">
            var clickCalledAfterRadconfirm = false;
            var lastClickedItem = null;
            var isrespond = false;
            var respondmsg = null;
            /*  Rad Window Start  */
            function openWins(url, winid, para, width, height) {
                var _contparameter = '';
                var _controlfill = $get('<%= this._hidField.ClientID%>');
                _controlfill.value = '';
                switch (para.toLowerCase()) {
                    case "item_ln":
                    case "lookup_resource_group_hdr":
                        _contparameter = "&_qReturnto=" + para;
                        break;
                    default:
                }
                var oWnd = $find("<%=_radWinManagers.ClientID %>").open(url + _contparameter, winid);
                setBehaviors(oWnd);
                oWnd.SetSize(width, height);
                oWnd.SetModal(true);
            }
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                return oWindow;
            }
            function setBehaviors(oWnd) {
                oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Pin + Telerik.Web.UI.WindowBehaviors.Reload + Telerik.Web.UI.WindowBehaviors.Close);
            }
            function Usc_OnClientClose(oWnd, args) {
                //get the transferred arguments           
                var arg = args.get_argument();
                if (arg) {
                    var vals = arg.vals;
                    var cmds = arg.cmds;
                    var valext = arg.valext;
                    var _controlfill = $get('<%= this._hidField.ClientID%>');
                    _controlfill.value = '';
                    _controlfill.value = vals;
     
                    var ajaxManager = $find("<%= _radAjManagers.ClientID %>");
                    if ((ajaxManager == null) || (ajaxManager == undefined))
                        return false;
                    if (_controlfill) {
                        switch (cmds.toLowerCase()) {
                            case 'lookup_item_hdr': break;
                            case 'lookup_gl_hdr':
                            case 'lookup_item_ln':
                            case 'lookup_resource_group_hdr':
                                ajaxManager.ajaxRequest(cmds);
                                break;
                            default: break;
                        }
                    }
                }
                return false;
            }
            /*  Rad Window End  */       
        </script>
    </telerik:RadScriptBlock>
    <telerik:RadWindowManager ID="_radWinManagers" ShowContentDuringLoad="true" VisibleStatusbar="false"
        ReloadOnShow="false" runat="server" Skin="Default" EnableShadow="true">
        <Windows>
            <telerik:RadWindow ID="_radWinItems" runat="server" Behaviors="Pin,reload,close,move"
                OnClientClose="Usc_OnClientClose">
            </telerik:RadWindow>
            <telerik:RadWindow ID="_radDialog" runat="server" Behaviors="Pin,reload,close,move"
                OnClientClose="Usc_OnClientClose">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <telerik:RadAjaxManager ID="_radAjManagers" runat="server" OnAjaxRequest="_radAjManager_AjaxRequest">
        <AjaxSettings>                      
        </AjaxSettings>
    </telerik:RadAjaxManager>

    Code

    #region "RadControl"
     
        protected void _radAjManager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
        {
            switch (e.Argument)
            {
                case "lookup_item_ln":
                case "lookup_resource_group_hdr":
                    GetItemInfo();
                    break;           
                default: break;
            }
        }
     
    #endregion

    Regards
    Alex.
  2. ALEX
    ALEX avatar
    61 posts
    Member since:
    Feb 2011

    Posted 21 Feb 2012 Link to this post

    Hi Team,

             Any idea for my problem?

    Regards,
    Alex
  3. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 21 Feb 2012 Link to this post

    Hello,

    The mentioned error most commenly appear in case you have nested UpdatePanels rendered on the page which is caused by nested RadAjax settings in the markup. Could you please elaborate a bit more on your scenario. What your RadAjax settings are and how the mentioned AjaxRequest is fired?
    Some more information on your scenario and ensuring that no nested ajax settings persists could help us easily isolate the root cause of the problem.

    Regards,
    Maria Ilieva
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  4. ALEX
    ALEX avatar
    61 posts
    Member since:
    Feb 2011

    Posted 21 Feb 2012 Link to this post

    Hi Maria Ilieva,

               Thanks for your take time.
    My scenario is so simple. Item Listing page show when i click the item button browser and after select the item i call back RadAjaxManager onRequest function in source page. I got that error after run the ajax trigger. My code is already posted. Please find attach for sample. If i use with _dopost no error. I don't want to use _dopost event. Can you give me suggestion.

    Noted: Item Listing select function is same the example of rad window call back function.


    Regards,
    Alex
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 24 Feb 2012 Link to this post

    Hi Alex,

    From the provided code I noticed that you do not have any ajax settings in the RadAjaxManager. Please note that in order to perform ajaxRequest through the RadAjaxManager you should have a setting in the RadAjaxManager updates the controls which will be updated on that request.
    Give this a try and let me know if it makes any difference.

    Regards,
    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.
  6. ALEX
    ALEX avatar
    61 posts
    Member since:
    Feb 2011

    Posted 29 Apr 2012 Link to this post

    Hi Maria Ilieva,

           Sorry for my reply is too late for you. I'm trying to do sample for my case please check my post Grid Error and Ajax it will be related with this case.

    Regards,
    Alex
  7. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 02 May 2012 Link to this post

    Hello,

    In the other forum post you have opened for the same issue the first thing I noticed is that you are suing second RadAjaxManager in the WebUserControl which is used for edit form of the RadGrid. Note that you could not use two RadAjaxManager in the same application. Also in this case the usage of the other AjaxManager is totally unnecessary as you have a setting in the main page where the RadGrid control updates itself. This means that all controls in the RadGrid as it edit form will perform ajax request without adding explicitly settings for the UserControl. However in order to register the script after ajax request you should use one of the approaches provided in the following help topic:
    http://www.telerik.com/help/aspnet-ajax/ajax-execute-custom-javascript.html

    Give this a try and let me know if it works for you.

    Greetings,
    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.
  8. ALEX
    ALEX avatar
    61 posts
    Member since:
    Feb 2011

    Posted 03 May 2012 Link to this post

    Hi Maria Ilieva,

             Thanks for your reply. Now i knowing ajax manager can use only one place. What i want is after user select the item i need the retrieve data from related table. Currently i use this way in my usercontrol.

    function Usc_OnClientClose(oWnd, args) {
                //reset title and remove close event
                oWnd.set_title('');
                oWnd.remove_close(Usc_OnClientClose);
                //get the transferred arguments           
                var arg = args.get_argument();
                if (arg) {
                    var vals = arg.vals;
                    var cmds = arg.cmds;
                    var valext = arg.valext;
                    var _controlfill = $get('<%= this._hidField.ClientID%>');
                    _controlfill.value = '';
                    _controlfill.value = vals;
                    //                var ajaxManager = $find("<%= _radAjManagers.ClientID %>");
                    //                if ((ajaxManager == null) || (ajaxManager == undefined))
                    //                    return false;
                    if (_controlfill) {
                        switch (cmds.toLowerCase()) {                      
                            case 'lookup_resource_group_hdr':
                                //                            ajaxManager.ajaxRequest(cmds);
                                __doPostBack('<%= this._imgbtnItem.UniqueID %>', ''); //currently use this method
                                break;
                            default: break;
                        }
                    }
                }
                return false;
            }

     So i want to replace with ajaxManager request method. Retrieve function is inside usercontrol so how can i call from my main page ajax response.

    If you have any idea kindly please me know. I'm trying to understand & using your control.

    Regards,
    Alex
  9. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 08 May 2012 Link to this post

    Hi,

    In case you need to handle the master manager events in the user control, you can attach event handlers to the manager as follows:
    JS:
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function myUserControlClickHandler() {
                $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("content");
            }
        </script>
    </telerik:RadCodeBlock>

    C#:
    protected void Page_Load(object sender, EventArgs e)
    {
        RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
        manager.ClientEvents.OnRequestStart = "onRequestStart";
        manager.ClientEvents.OnResponseEnd = "onResponseEnd";
        manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(manager_AjaxRequest);
    }
    protected void manager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
    {
        //handle the manager AjaxRequest event here
    }


    All the best,
    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.
  10. ALEX
    ALEX avatar
    61 posts
    Member since:
    Feb 2011

    Posted 08 May 2012 Link to this post

    Hi Maria Ilieva,

            Thanks for your kindly reply. That one what i want and i want to use your code. So I put your code to my sample site but i got error "onRequestStart is undefined". Please find screenshot for more detail.

    User Control.ascx

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs"
        Inherits="control_WebUserControl" %>
    <telerik:RadScriptBlock runat="server" ID="_rScriptBlock">
        <script type="text/javascript" language="javascript">
            //Put your JavaScript code here.       
            function myUserControlClickHandler() {
                alert('event is fired');
                $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("content");
            }
        </script>
    </telerik:RadScriptBlock>
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Click" EventName="OnClientClick">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="_lblstatus" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <div>
        <telerik:RadAjaxPanel runat="server" ID="aj">
        </telerik:RadAjaxPanel>
        <asp:Label runat="server" ID="_lblstatus" Text="Label"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.Description" ) %>'></asp:TextBox>
        <br />
        <asp:Button ID="btnInsert" Text="Insert" runat="server" OnClientClick="javascript:fnUpdate();return false;">
        </asp:Button>
        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel"></asp:Button>
        <br />
        <%--Below Code for Ajax Testing--%>
        <asp:Button runat="server" ID="Click" Text="Click" OnClientClick="javascript:myUserControlClickHandler();return false;" />
        <input id="Button1" type="button" value="button"  onclick="myUserControlClickHandler()" />
        <%--<input type="button" value="Change color" onclick="invokeAjaxRequest();" />--%>
    </div>
    CB of User Control

    protected void Page_Load(object sender, EventArgs e)
        {      
            RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
            manager.ClientEvents.OnRequestStart = "onRequestStart";
            manager.ClientEvents.OnResponseEnd = "onResponseEnd";
            manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(manager_AjaxRequest);
            //if (!Page.IsPostBack)
            //{
                //Click.Attributes.Add("OnClientClick", "javascript:return invokeAjaxrequest();");// string.Format("realPostBack(\"{0}\", \"\"); return false;", Click.UniqueID));
            //}
        }
    protected void manager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
        {
            //handle the manager AjaxRequest event here
            _lblstatus.Text =  System.DateTime.Now.ToString();
        }

    Is it my code is wrong?

    Regards,
    Alex
  11. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 11 May 2012 Link to this post

    Hello,

    The error you are facing is expected as you handle the client OnRequestStart and OnResponseEnd int he code behind but you do not have declared "onRequestStart" and "onResponseEnd" in your client scripts. If you need to handle just the server AjaxRequest event please keep just the code for handling this event. Like this:
    protected void Page_Load(object sender, EventArgs e)
        {       
            RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
            manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(manager_AjaxRequest);
        }

    I hope this helps.

    Kind regards,
    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.
  12. ALEX
    ALEX avatar
    61 posts
    Member since:
    Feb 2011

    Posted 11 May 2012 Link to this post

    Hi Maria Ilieva,


                  Thanks for your help. It is worked. If you don't mind kindly please give a idea to me on this case AjaxMng & Text Change.

    Best Regards,
    Alex
  13. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 14 May 2012 Link to this post

    Hello Alex,

    I reviewed the mentioned ticket and was able to replicate the problematic beahvior in the application my colleague provided. However note that this is generic MS Ajax issue in IE browsers. Event using regular asp UpdatePanel to ajaxify the label and the textbox the same problem will appear. Therefore the issue is not related to our RadControls.

    You could simply try the following:
    <asp:UpdatePanel ID="UP1" runat="server">
                   <ContentTemplate>
                       <asp:Panel runat="server" ID="_pnlLine">
                           <asp:Label runat="server" ID="_lblTime" Text="Time"></asp:Label><br />
                           <asp:TextBox runat="server" ID="_txtBox" OnTextChanged="_txtBox_TextChanged" AutoPostBack="true"></asp:TextBox><br />
                           <asp:TextBox runat="server" ID="TextBox1" Text="Nothing"></asp:TextBox>
                       </asp:Panel>
                   </ContentTemplate>
               </asp:UpdatePanel>
     and the same behaviour will appear.

    Greetings,
    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.
  14. ALEX
    ALEX avatar
    61 posts
    Member since:
    Feb 2011

    Posted 14 May 2012 Link to this post

    Hi Maria Ilieva,

               Thanks to you and your colleague for kindly reply my topic.
    I tested with "asp:UpdatePanel". It also same "Error". Now, i have no idea for this.

    Thanks for your help.

    Best Regards,
    Alex
  15. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 15 May 2012 Link to this post

    Hi Alex,

    Unfortunately we could not provide a fix for the presented issue as like I mentioned and you tested by yourself it is a generic MS Ajax problem.
    In case you are facing any issues with our RadControl in future we will be happy to help you and do the best to provide proper solutions.

    Thank you for your cooperation.

    All the best,
    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