balloon popup extender inside gridview header displays on every postback

334 Views Asked by At

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

1

There are 1 best solutions below

0
On BEST ANSWER

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