locked
Baloon popup on timer RRS feed

  • Question

  • User1698941362 posted

    Hi All,

    I want my popup baloon to show and hide on timer, but I have problems to achieve it. Here is my code for now:

                var ctr = 0;

                function changepopup() {
                    var popup = document.getElementById('Button5');

                    if (ctr == 1) {
                        popup.BalloonPopupControlBehavior.hidePopup();
                        ctr = 0;
                    }
                    else {
                        popup.BalloonPopupControlBehavior.showPopup();
                        ctr++;
                    }
                    myTimeout();
                }


                function myTimeout() {
                    var t = setTimeout('changepopup();', 3000);
                }

    Monday, November 11, 2013 4:35 PM

Answers

  • User1698941362 posted

    I found the solution:

                    var ctrl = document.getElementById('<%=Button5.ClientID%>');
                    if (ctrl) {
                        if (ctrl.BalloonPopupControlBehavior._popupVisible == true) {
                            ctrl.BalloonPopupControlBehavior.hidePopup();
                        }
                        else {
                            ctrl.BalloonPopupControlBehavior.showPopup();
                        }
                    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 12, 2013 6:19 PM

All replies

  • User555306248 posted

    Refer this - http://forums.asp.net/t/1743894.aspx

    Monday, November 11, 2013 11:16 PM
  • User1698941362 posted

    I made it like in example and it doesn't work either.

            <script type="text/javascript">

                function changepopup() {
                    var ctrl = $find('PopupCnt');

                    event.cancelBubble = true;

                    if (ctrl._popupVisible == true)
                        ctrl.hidePopup();
                    else
                        ctrl.showPopup();
                }


                function myTimeout2() {
                    var b = setTimeout('changepopup();', 3000);
                }

        </script>

                                                            <asp:Panel runat="server" ID="Panel1" >Sprawdź ile kalorii ma ten przepis</asp:Panel>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <asp:Button ID="Button5" CssClass="button2" runat="server" Text="Użyj"
                                    onclick="Button5_Click"  Height="40px" Width="140px" Font-Size="Larger"/>
                                                                                            <asp:BalloonPopupExtender ID="BalloonPopupExtender2" BehaviorID="PopupCnt" runat="server" UseShadow="true"
                                        DisplayOnClick="False" DisplayOnMouseOver="True" BalloonStyle="Custom" CustomCssUrl="~/Styles/Site.css" CustomClassName="oval"
                                        TargetControlID="Button5" BalloonPopupControlID="panel1">
                                    </asp:BalloonPopupExtender>

    Tuesday, November 12, 2013 3:03 PM
  • User1698941362 posted

    I found the solution:

                    var ctrl = document.getElementById('<%=Button5.ClientID%>');
                    if (ctrl) {
                        if (ctrl.BalloonPopupControlBehavior._popupVisible == true) {
                            ctrl.BalloonPopupControlBehavior.hidePopup();
                        }
                        else {
                            ctrl.BalloonPopupControlBehavior.showPopup();
                        }
                    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 12, 2013 6:19 PM