0

I am new to balloon popup extender. I am giving a balloon popup extender for Gridview header, This is my code. I don't know where I am going wrong. When I click a button on the page, the balloon popup extender appears on top left of the page, and it appears on every postback caused by any buttons on the page. I don't know to hide it and document.getElementById("blnHeaderRowA") gives null reference. Is there any workarounds? <asp:BoundField HeaderText="" DataField="Row_id"/>

   <asp:TemplateField>
    <HeaderTemplate >
    
        <asp:Label ID="lblHeaderRowA" runat="server" Text="A" onmouseout="omo(this.BalloonPopupControlBehavior);"></asp:Label>
        <asp:BalloonPopupExtender Enabled="false" ID="blnHeaderRowA" runat="server" TargetControlID="lblHeaderRowA" UseShadow="true" DisplayOnMouseOver="true" Position="BottomRight" BalloonPopupControlID="pnlHeaderRowPopupA" DisplayOnClick="false" DisplayOnFocus="false"></asp:BalloonPopupExtender>
        <asp:Panel ID="pnlHeaderRowPopupA" runat="server" ><asp:Label ID="lblHeaderRowPopupA" runat="server" ForeColor="Black" ></asp:Label></asp:Panel>
        
    </HeaderTemplate>
    <ItemTemplate>
        <asp:Label ID="lblA" runat="server" Text='<%# Bind("A") %>' ></asp:Label>
    </ItemTemplate>
   </asp:TemplateField>

this is my javascript to hide the balloon popup extender

function omo(obj) {
        if (obj != null) {
            
            obj.hidePopup();
            
        }
    }

My main motto being, how to avoid BalloonPopupExtender from appearing on every postback of the page pertaining my code. thanks in advance

novice in DotNet
  • 771
  • 1
  • 9
  • 21
  • Hi, I have created a work around, call showPopup() and hidePopup() one after the other on each postback, and it disappears on each postback :P – novice in DotNet Jul 19 '17 at 13:41

1 Answers1

0

Hi add this to Page_Load outside !IsPostBack

ScriptManager.RegisterStartupScript(Page, Page.GetType(), "hidePopup","document.getElementById('"+((Label)GvR045F.HeaderRow.FindControl("lblHeaderRowPopupA")).ClientID+"').BalloonPopupControlBehavior.showPopup();document.getElementById('"+((Label)GvR045F.HeaderRow.FindControl("lblHeaderRowPopupA")).ClientID+"').BalloonPopupControlBehavior.hidePopup();",true);

Thanks

novice in DotNet
  • 771
  • 1
  • 9
  • 21