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

Refresh Radnotification

5 Answers 203 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
AppliedHCS
Top achievements
Rank 1
AppliedHCS asked on 08 Nov 2012, 02:33 PM
Hello,

I am using RadNotification control with RadGrid which is inside contentTemplate of it. I am generating RadNotification in some interval (i.e. using javascript function setInterval) with respect to condition. I am binding Radgrid in OnRadAjaxRequest Event.
Issue: Radgrid is not refreshing during every interval.

Below code is listes in Master Page

Javascript
setInterval(function () { $find("<%= RamMaster.ClientID %>").ajaxRequest("Reminder"); }, 10000);

Master.aspx
<div>
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td>  
                    <telerik:RadNotification ID="n1" runat="server" Text="Initial text" Position="Center"
                        Style="z-index: 0" AutoCloseDelay="0" Width="700px" Title="Reminder">
                        <ContentTemplate>
                            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                <tr>
                                    <td align="right">
                                        <span style="color: Red">*</span><strong>Move the mouse over a Message to see more details</strong>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <telerik:RadAjaxPanel ID="rap" runat="server">
                                            <telerik:RadGrid ID="gvReminder" runat="server" Width="100%" AutoGenerateColumns="false"
                                                PageSize="10" ShowStatusBar="true" ClientIDMode="AutoID" AllowPaging="true" AllowSorting="false"
                                                Skin="Office2007" OnNeedDataSource="gvReminder_NeedDataSource">
                                                <MasterTableView DataKeyNames="ReminderID">
                                                    <Columns>
                                                        <telerik:GridBoundColumn DataField="ReminderID" Visible="false" />
                                                        <telerik:GridTemplateColumn HeaderText="Message" HeaderStyle-Font-Bold="true">
                                                            <ItemTemplate>
                                                                <asp:HyperLink ID="targetControl" runat="server" Text='<%#TextLimitString(Eval("Message").ToString()) %>'></asp:HyperLink>
                                                                <telerik:RadToolTip ID="tltRttip" runat="server" TargetControlID="targetControl"
                                                                    AutoCloseDelay="0" ShowEvent="OnMouseOver" Skin="Office2007">
                                                                    <div>
                                                                        <div style="margin: 0 auto; text-align: center">
                                                                            New Note From <b>
                                                                                <%# GetUserName(Eval("CreatedBy").ToString()) %></b></div>
                                                                        <br />
                                                                        <div style="float: left; width: 100px">
                                                                            <b>Patient Name:</b></div>
                                                                        <div>
                                                                            <%#Eval("PatName")%>
                                                                        </div>
                                                                        <br />
                                                                        <div style="float: left; width: 100px">
                                                                            <b>Message:</b></div>
                                                                        <div>
                                                                            <%#Eval("Message") %></div>
                                                                    </div>
                                                                </telerik:RadToolTip>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true" HeaderText="Snooze">
                                                            <ItemTemplate>
                                                                <telerik:RadComboBox ID="RcbSnooze" runat="server" Style="z-index: 100000">
                                                                    <Items>
                                                                        <telerik:RadComboBoxItem Text="1 Min" Value="1" Selected="true" />
                                                                        <telerik:RadComboBoxItem Text="5 Min" Value="5" />
                                                                        <telerik:RadComboBoxItem Text="10 Min" Value="10" />
                                                                        <telerik:RadComboBoxItem Text="20 Min" Value="20" />
                                                                        <telerik:RadComboBoxItem Text="30 Min" Value="30" />
                                                                    </Items>
                                                                </telerik:RadComboBox>
                                                                <telerik:RadButton ID="btnSnooze" runat="server" Text="Snooze" OnClick="btnID_Click"
                                                                    CommandName='<%# Eval("ReminderID") %>' CommandArgument="False" />
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Center">
                                                            <ItemTemplate>
                                                                <telerik:RadButton ID="btnID" runat="server" Text="Dismiss" OnClick="btnID_Click"
                                                                    CommandName='<%# Eval("ReminderID") %>' CommandArgument="True" />
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                    </Columns>
                                                </MasterTableView>
                                            </telerik:RadGrid>
                                        </telerik:RadAjaxPanel>
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                        <NotificationMenu ID="TitleMenu">
                        </NotificationMenu>
                    </telerik:RadNotification>
                </td>
            </tr>
        </table>
    </div>
  
Master.aspx.cs
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
       {
           try
           {
               dt = new DataTable();
               if (e.Argument == "Reminder")
               {
                   CurUsr = 14;
                   _objPD.FillReminderList(CurUsr, gvReminder);
                   gvReminder.DataBind();
                   if (gvReminder.Items.Count > 0)
                   {
                       n1.Show();
                   }
               }
           }
           catch (Exception ex)
           {
               throw ex;
           }
           finally
           {
           }
       }

5 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 09 Nov 2012, 12:15 PM
Hello,

I would advise against using UpdatePanels inside the notification, because the COntentTemplate is internally a RadXmlHttpPanel, so it is designed to work with client callbacks and not postbacks. What I can also suggest is using the UpdateInterval property of the notification together with its server OnCallbackUpdate handler instead of the AJAX requests. More on that is available in the online demos:
http://demos.telerik.com/aspnet-ajax/notification/examples/callback/defaultcs.aspx - shows how you can update content on interval and use a server handler for it
http://demos.telerik.com/aspnet-ajax/notification/examples/updateinterval/defaultcs.aspx - shows an idea on re-showing the notification only if new data is received.

Note you cannot call the Show() server method from within the callback because of the way callbacks wor, but you can configure the ShowInterval or use the OnClientUpdated event to show it with only one line of JavaScript.

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.
0
AppliedHCS
Top achievements
Rank 1
answered on 27 Nov 2012, 11:58 AM
Hello Marin,

Sorry for delay.

As per your suggestion i tried but getting an error as below:

XmlHttpPanel Loading error:
Exception=Script control 'tltRttip' is not a registered script control.
Script controls must be registered using RegisterScriptControl() before
calling RegisterScriptDescriptors().
Parameter name: scriptControl

My code is as below:

Javascript:
function OnClientUpdated(sender, args) {              
               sender.show();
           }

.aspx page:
<telerik:RadNotification ID="n1" runat="server" Text="Initial text" Position="Center"
                        LoadContentOn="TimeInterval" OnClientUpdated="OnClientUpdated" UpdateInterval="30000"
                        OnCallbackUpdate="OnCallbackUpdate" Style="z-index: 0" AutoCloseDelay="0" Width="700px"
                        Title="Reminder">
                        <ContentTemplate>
                            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                <tr>
                                    <td align="right">
                                        <span style="color: Red">*</span><strong>Move the mouse over a Message to see more details</strong>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <telerik:RadAjaxPanel ID="rap" runat="server">
                                            <telerik:RadGrid ID="gvReminder" runat="server" Width="100%" AutoGenerateColumns="false"
                                                PageSize="10" ShowStatusBar="true" ClientIDMode="AutoID" AllowPaging="true" AllowSorting="false"
                                                Skin="Office2007" OnNeedDataSource="gvReminder_NeedDataSource">
                                                <MasterTableView DataKeyNames="ReminderID">
                                                    <Columns>
                                                        <telerik:GridBoundColumn DataField="ReminderID" Visible="false" />
                                                        <telerik:GridTemplateColumn HeaderText="Message" HeaderStyle-Font-Bold="true">
                                                            <ItemTemplate>
                                                                <asp:HyperLink ID="targetControl" runat="server" Text='<%#TextLimitString(Eval("Message").ToString()) %>'></asp:HyperLink>
                                                                <telerik:RadToolTip ID="tltRttip" runat="server" TargetControlID="targetControl"
                                                                    AutoCloseDelay="0" ShowEvent="OnMouseOver" Skin="Office2007">
                                                                    <div>
                                                                        <div style="margin: 0 auto; text-align: center">
                                                                            New Note From <b>
                                                                                <%# GetUserName(Eval("CreatedBy").ToString()) %></b></div>
                                                                        <br />
                                                                        <div style="float: left; width: 100px">
                                                                            <b>Patient Name:</b></div>
                                                                        <div>
                                                                            <%#Eval("PatName")%>
                                                                        </div>
                                                                        <br />
                                                                        <div style="float: left; width: 100px">
                                                                            <b>Message:</b></div>
                                                                        <div>
                                                                            <%#Eval("Message") %></div>
                                                                        <br />
                                                                        <div style="float: left; width: 100px">
                                                                            <b>Reminder Date:</b></div>
                                                                        <div>
                                                                            <%#Eval("ShowTime") %></div>
                                                                    </div>
                                                                </telerik:RadToolTip>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
                                                            HeaderStyle-Font-Bold="true" HeaderText="Snooze">
                                                            <ItemTemplate>
                                                                <telerik:RadComboBox ID="RcbSnooze" runat="server" Style="z-index: 50000">
                                                                    <Items>
                                                                        <telerik:RadComboBoxItem Text="1 Min" Value="1" Selected="true" />
                                                                        <telerik:RadComboBoxItem Text="5 Min" Value="5" />
                                                                        <telerik:RadComboBoxItem Text="10 Min" Value="10" />
                                                                        <telerik:RadComboBoxItem Text="20 Min" Value="20" />
                                                                        <telerik:RadComboBoxItem Text="30 Min" Value="30" />
                                                                    </Items>
                                                                </telerik:RadComboBox>
                                                                <telerik:RadButton ID="btnSnooze" runat="server" Text="Snooze" OnClick="btnID_Click"
                                                                    CommandName='<%# Eval("ReminderID") %>' CommandArgument="False" />
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Center">
                                                            <ItemTemplate>
                                                                <telerik:RadButton ID="btnID" runat="server" Text="Dismiss" OnClick="btnID_Click"
                                                                    CommandName='<%# Eval("ReminderID") %>' CommandArgument="True" />
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                    </Columns>
                                                </MasterTableView>
                                            </telerik:RadGrid>
                                        </telerik:RadAjaxPanel>
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                        <NotificationMenu ID="TitleMenu">
                        </NotificationMenu>
                    </telerik:RadNotification>

.cs Page:
protected void gvReminder_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            CurUsr = UserSession.USRN;
            _objPD.FillReminderList(CurUsr, gvReminder);
            if (gvReminder.Items.Count > 0)
                n1.Show();
        }
 
protected void OnCallbackUpdate(object sender, RadNotificationEventArgs e)
        {
            gvReminder.Rebind();
        }

Thanks
0
Rumen
Telerik team
answered on 30 Nov 2012, 08:24 AM
Hello,

Could you please remove the <telerik:RadAjaxPanel as well as try the instructions provided in this help article Known Issues and test again?

Make sure that you are also using the latest version of RadControls for ASP.NET AJAX

All the best,
Rumen
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.
0
AppliedHCS
Top achievements
Rank 1
answered on 30 Nov 2012, 12:57 PM
Hi,

thanks for your response.

I removed <telerik:RadAjaxPanel> but giving me same error.

Actually in my case  this functionality is implemented in master page and i have not added script manager in that page.
Because i added on each page. This is my limitation right now.

Also i am using latest version  of RadControls for ASP.NET AJAX

Thanks
0
Marin Bratanov
Telerik team
answered on 03 Dec 2012, 12:15 PM
Hello,

Can you confirm you have tried all three options suggested in the help article my colleague Rumen linked? Do none of them help, even the third option that modifies the notification itself? If this is the case I advise that you open a support ticket and send us a runnable project that mimics your actual setup and clearly shows the problem. The steps from this blog post can be helpful in isolating such a sample.


Regards,
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
General Discussions
Asked by
AppliedHCS
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
AppliedHCS
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or