This is a migrated thread and some comments may be shown as answers.

Ajaxified Content Controls Issue

1 Answer 75 Views
Notification
This is a migrated thread and some comments may be shown as answers.
Igor
Top achievements
Rank 1
Igor asked on 09 Oct 2012, 10:45 AM
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"
        oncallbackupdate="notifyMessage_CallbackUpdate">
       <ContentTemplate>
 
            <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>
            </div>
 
        </ContentTemplate>
        <NotificationMenu ID="TitleMenu"></NotificationMenu>
</
telerik:RadNotification>

I have added these ajax settings to AjaxManagerProxy

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

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?

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 10 Oct 2012, 10:46 AM
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">
    <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="listMessages" />
        <%--<telerik:AjaxUpdatedControl ControlID="notifyMessage" />--%>
    </UpdatedControls>
</telerik:AjaxSetting>

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).

Greetings,
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.
Tags
Notification
Asked by
Igor
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or