Ajaxified Content Controls Issue

2 posts, 1 answers
  1. Igor
    Igor avatar
    1 posts
    Member since:
    Jul 2012

    Posted 09 Oct 2012 Link to this post

    I'm trying to ajaxify a button placed in the content template of notification. I use notification to check if there're new post in the thread being viewed by user and display a nofication with a button that will update listview with ajax call when user click button.

    <telerik:RadNotification ID="notifyMessage" runat="server"
            LoadContentOn="TimeInterval" Width="250"
            Animation="Fade" EnableRoundedCorners="true" EnableShadow="true"
            Title="Message" OnClientUpdated="OnClientUpdated" Height="90" ContentIcon="none"
            OffsetX="-20" OffsetY="-20" TitleIcon="none" UpdateInterval="10000" AutoCloseDelay="0"
            KeepOnMouseOver="true" ShowCloseButton="true"
                <div class="center">
                    <p>New Message Have Been Posted.</p>
                    <p class="paddingBottomLite">Show It?</p>
                    <telerik:RadButton ID="btnNotifyView" runat="server" Text="View"
                      onclick="btnNotifyView_Click" Width="75px"></telerik:RadButton>
            <NotificationMenu ID="TitleMenu"></NotificationMenu>

    I have added these ajax settings to AjaxManagerProxy

    <telerik:AjaxSetting AjaxControlID="btnNotifyView">
                    <telerik:AjaxUpdatedControl ControlID="listMessages" />
                    <telerik:AjaxUpdatedControl ControlID="notifyMessage" />

    Now, everything work perfectly fine. The first time user clicks on button it makes a proper ajax call, but after that button looses ajax functionality and cause full page postback on click.

    Any ideas what might be killing ajax functionality of button after initial successful ajax call?
  2. Answer
    Marin Bratanov
    Marin Bratanov avatar
    4441 posts

    Posted 10 Oct 2012 Link to this post

    Hello Igor,

    I advise that you remove the notification from the list of updated controls. This disposes it so the button inside disposes as well and therefore the RadAjaxManager loses its AJAX initiator. Also, the notification uses a RadXmlHttpPanel control internally to provide its callbacks so this does not play very well with partial postbacks because of the nature of the webform callbacks. You can check this help article for more details on the matter.
    <telerik:AjaxSetting AjaxControlID="btnNotifyView">
            <telerik:AjaxUpdatedControl ControlID="listMessages" />
            <%--<telerik:AjaxUpdatedControl ControlID="notifyMessage" />--%>

    Then, to close the notification you can use its Client-side API and the RadButton's client-side click to call its hide() method. If need be, you can also disable autoamtic updates by set_updateInterval(0).

    Marin Bratanov
    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