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

Using RadNotification problem(update)

3 Answers 264 Views
Notification
This is a migrated thread and some comments may be shown as answers.
shunman
Top achievements
Rank 1
shunman asked on 15 Sep 2011, 10:30 AM
First of all, I"m sorry for my not good english.
 I'm writing new post in order to asking more question.
I'm trying to control Radnotification's Interval at Client-side.
My question is.
 - If ShowInterval value is smaller than AutoCloseDelay's value, Notificaiton does not hide
   e.g)ShowInterval ="7000", AutoCloseDelay="4000"

- when i set keepOnMouseOver property to "false",showInterval was changed. ShowInterval ="7000", AutoCloseDelay="4000"
  In my opinion, notification window will show every 7000ms, but it showed every 3000ms.

 - I moved mouse cursor on the notification window before hiding.Despite AutoCloseDelay reached time, It's not hided because 
   keepOnMouseOver was activating. And immediately i turned keepOnMouseOver property to "false" by clicking checkbox. And mouse moved  outside when the time is 0.
   In that case, notification window is doesn't work. I expected that notification's _showTimer field is null.

anyone have idea? I'm not sure there are bugs or my fault.
thank you.

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="RadControlsWebApp4._Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
    </div>
    <script type="text/javascript">
        var firstNotificationShowTime = 0;
        var firstNotificationHideTime = 0;
         
        var firstNotificationStatus;
 
        var timer;
 
        $(document).ready(function () {
            var firstNotification = $find("<%=RadNotificationFirst.ClientID %>");          
 
            $("#TextBoxFirstNotificationShowInterval").val(firstNotification.get_showInterval() / 1000);
            $("#TextBoxFirstNotificationHideInterval").val(firstNotification.get_autoCloseDelay() / 1000);
 
            firstNotificationShowTime = firstNotification.get_showInterval() / 1000;
 
 
            firstNotificationStatus = "show";
 
 
            setTimeout("CountInterval()", 0);
 
            timer = setInterval("CountInterval()", 1000);
 
        });
 
        function CountInterval() {
            if (firstNotificationStatus == "show") {
                if (firstNotificationShowTime > 0) {
                    firstNotificationShowTime -= 1;
                    $("#tdOutputFirst").html("Notification will show after " + firstNotificationShowTime + " seconds");
                }
            }
            else {
                if (firstNotificationHideTime > 0) {
                    firstNotificationHideTime -= 1;
                    $("#tdOutputFirst").html("Notification will hide after " + firstNotificationHideTime + " seconds");
                }
            }
        }
 
        function ChangeNotificationTimer() {
            var firstNotification = $find("<%=RadNotificationFirst.ClientID %>");
 
 
            var firstNotificationShowInterval = $("#TextBoxFirstNotificationShowInterval").val();
            var firstNotificationHideInterval = $("#TextBoxFirstNotificationHideInterval").val();
 
            firstNotification.set_showInterval(firstNotificationShowInterval * 1000);
            firstNotification.set_autoCloseDelay(firstNotificationHideInterval * 1000);
 
            firstNotificationShowTime = firstNotification.get_showInterval() / 1000;
            firstNotificationHideTime = firstNotification.get_autoCloseDelay() / 1000;
 
            return false;
        }
 
        function OnClientShown(sender, args) {
             
            firstNotificationStatus = "hide";
            firstNotificationHideTime = sender.get_autoCloseDelay() / 1000;
 
        }
 
        function OnClientHidden(sender, args) {
            firstNotificationStatus = "show";
 
            if (sender.get_keepOnMouseOver() == false) {
                firstNotificationShowTime = (sender.get_showInterval() - sender.get_autoCloseDelay()) / 1000;
            }
            else {
                firstNotificationShowTime = sender.get_showInterval() / 1000;
            }
        }
 
        function ToggleKeepOnMouseOver(args) {
            var Notification;
 
            Notification = $find("<%=RadNotificationFirst.ClientID %>");
 
            var keepOnMouseOver = Notification.get_keepOnMouseOver();
 
            if (keepOnMouseOver == true) {
                Notification.set_keepOnMouseOver(false);
            }
            else {
                Notification.set_keepOnMouseOver(true);
            }
        }
             
    </script>
    <table cellpadding="0" cellspacing="0" style="margin: 0 auto;">
        <tr>
            <td class="tdLeftContent">
                First Notification Show Interval
            </td>
            <td class="tdRightContent">
                <asp:TextBox ID="TextBoxFirstNotificationShowInterval" runat="server"></asp:TextBox>
                second
            </td>
 
        </tr>
        <tr>
            <td >
                First Notification Hide Interval
            </td>
            <td>
                <asp:TextBox ID="TextBoxFirstNotificationHideInterval" runat="server"></asp:TextBox>
                second
            </td>
        </tr>
        <tr>
            <td>
                KeepOnMouseOver
            </td>
            <td >
                <asp:CheckBox ID="CheckBoxFirstNotificationKeepOnMouseOver" Checked="true" runat="server"
                    Text="" onclick="return ToggleKeepOnMouseOver('first');" />
            </td>
        </tr>
        <tr>
            <td style="text-align: center;" colspan="4">
                <asp:Button ID="Button1" runat="server" Text="Change" OnClientClick="return ChangeNotificationTimer();" />
            </td>
        </tr>
        <tr>
            <td id="tdOutputFirst" style="text-align: center;" colspan="2">
            </td>
            <td id="tdOutputSecond" style="text-align: center;" colspan="2">
            </td>
        </tr>
    </table><div id="print"></div>
    <telerik:RadNotification ID="RadNotificationFirst" runat="server" Position="Center"
        ShowInterval="7000" AutoCloseDelay="4000" Width="300" Height="200" Title="First Notification"
        OffsetX="0" OffsetY="0" OnClientShown="OnClientShown" OnClientHidden="OnClientHidden"
        TitleIcon="" EnableRoundedCorners="true">
    </telerik:RadNotification>
    </form>
</body>
</html>

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 15 Sep 2011, 02:59 PM
Hello Shunman,

Please refer to your other thread on a similar matter for more information on your issue: http://www.telerik.com/community/forums/aspnet-ajax/notification/radnotification-interval-problem.aspx.

To explain it a bit differently here - the ShowInterval is reset every time the notification is shown, which is the reason why you feel like it shows every three seconds, as these three seconds is the time between its closing and next showing. If you wish to guarantee certain time between its closing and subsequent showing you should add this time to the AutoCloseDelay. I.e. something like ShowInterval=AutoCloseDelay+AnimationDuration x 2 in case KeepOnMouseOver is set to false. The intended behavior of the ShowInterval property is the interval between each show, not between a hide and show.


Kind regards,
Marin
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
0
shunman
Top achievements
Rank 1
answered on 19 Sep 2011, 07:54 AM
thank you for answering.
i tried a way to that you mentioned. ShowInterval=AutoCloseDelay+AnimationDuration x 2
but it was not same work too. showinterval was still faster that keepOnMouseOver is "false".

i just want to take same behavior between keepOnMouseOver =true and false.

would you more explain that?
0
Marin Bratanov
Telerik team
answered on 19 Sep 2011, 04:08 PM
Hello Shunman,

You cannot have the same behavior when the KeepOnMouseOver is true and when it is false. This is a very important property and it influences the entire client interaction of the control. If this property is set to true the closing is postponed but not the automated showing, and this behavior is by design, because the automated showing is likely to invoke an update of the content and thus we cannot change this timer.

As for your notification still not hiding - please make sure that you have added the correct numbers, you can start off by setting an explicit value for the AnimationDuration property and after you sum them up you can also add a small safety number, for example 500 or 1000ms. If you are still unable to resolve this I strongly suggest that you open a formal support ticket where you can send us a runnable project that reproduces the issue so we can debug it and pinpoint the cause. Also a video showing how you reproduce it would be helpful.


Greetings,
Marin
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
Tags
Notification
Asked by
shunman
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
shunman
Top achievements
Rank 1
Share this question
or