0

I am having issue with deleting record with RadAjaxManager.

TypeError: ajaxManager is null.

This is my Code:

Default.aspx:

<asp:Content ID="Content3" ContentPlaceHolderID="a1" runat="server">
    <uc1:ucMyUser runat="server" ID="ucMyUser"/>
</asp:Content>

ucMyUser:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <telerik:RadAjaxManager ID="RadAjaxManager2" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager2">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="Grid1" UpdatePanelCssClass="" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

 <telerik:RadGrid ID="rgEmpCategory" runat="server">
 <Columns>
    ---Rest other columns and configurations
    <asp:ImageButton runat="server" ID="Remove" Text="Remove" ToolTip="Remove" CommandArgument='<%#Eval("ID")%>' OnClick="Remove_Click" OnClientClick='<%# Eval("ID", "javascript:return Remove(\"{0}\");") %>' />
</Columns>

Master Page:

function Remove(val) {
      var Value= 'Remove';
      var ajaxManager = $find("ctl00_cphMain_RadAjaxManager2");
      var arg = Value + "," + val; //Remove,1(1 indicates Id here)
      ajaxManager.ajaxRequest(arg);
     }

Note:This above script is on my master page so i cant use like this:

var ajaxManager = $find("<%= RadAjaxManager2.ClientID %>");
I Love Stackoverflow
  • 6,738
  • 20
  • 97
  • 216

1 Answers1

1
  1. do NOT wrap RadAjaxManager in an UpdatePanel or anything of the sort

  2. move RadAjaxManager to your master page, this is where it belongs

  3. use RadAjaxManagerProxy or RadAjaxPanel controls in your user controls

  4. I also see you have found the correct way to refrence a RadAjaxManager on the client through the user of server code blocks

  5. Review this article on making your JS functions unique across UC instances so you can encapsulate them: http://www.telerik.com/support/kb/aspnet-ajax/details/using-dynamic-unique-names-for-javascript-functions.

rdmptn
  • 5,413
  • 1
  • 16
  • 29
  • Can you please provide some code for your described points and if i use RadAjaxManagerProxy or RadAjaxPanel then how would i reference it on client side i.e in my script?? – I Love Stackoverflow Nov 16 '15 at 06:00
  • 1
    Like any other IScriptContol - through $find(). Make sure to pass its clientid as an argument. See here http://docs.telerik.com/devtools/aspnet-ajax/controls/ajax/how-to/manually-add-an-ajax-request – rdmptn Nov 16 '15 at 07:10
  • Yeah ok thats fine but still i would like to see your solution describing all your points that you have listed in your solution in the form of code as it would help me to learn something new and too others too so it would be more bettter if you post some codes as because when searching for this issue i have already seen this points posted by you on some other question – I Love Stackoverflow Nov 16 '15 at 07:16
  • 1
    AJAX setup is extremely specific to each project and page. If I post something it may suit your setup, or may have nothing in common with your setup, or may even be harmful for your case. This is why general guidelines is all I offered. And all I will, based on this information. – rdmptn Nov 16 '15 at 13:50
  • can you help me with this question plz:http://stackoverflow.com/questions/33748799/validation-not-working-when-adding-query-string – I Love Stackoverflow Nov 17 '15 at 03:46