AJAX BalloonPopUp导致ASP.NET中的页面重新加载

时间:2014-05-29 02:10:10

标签: c# javascript asp.net ajax popup-balloons

我一直在使用Modal PopUp Extender很长一段时间了。我知道我需要将PopUp控制面板放在更新面板中以避免页面重新加载。这是我第一次使用balloonpop-up。我使用与ModalPopUp相同的方法,但单击目标按钮仍会导致页面重新加载。

这是弹出扩展程序和目标ID的代码:

<asp:ImageButton ID="B_HELP_SFtolerance" runat="server" BorderColor="Black" 
 BorderStyle="Solid" Height="21px" ImageUrl="~/Resources/1401344600_info6.png" 
 ToolTip="Scale Factor Tolerance Info." Width="25px" />


<ajaxToolkit:BalloonPopupExtender ID="B_HELP_SFtolerance_BalloonPopupExtender"
 runat="server"  BalloonPopupControlID="P_HELP_SFTolerance"
    Position="TopRight" 
    BalloonStyle="Rectangle"
    BalloonSize="Large"
    CustomCssUrl="CustomStyle/BalloonPopupOvalStyle.css"
    CustomClassName="oval"
    UseShadow="true" 
    ScrollBars="Auto"
    DisplayOnMouseOver="false"
    DisplayOnFocus="false"
    DisplayOnClick="true" TargetControlID="B_HELP_SFtolerance" >
    </ajaxToolkit:BalloonPopupExtender>

这是我的Panel PopUpControl ID的代码:

 <asp:Panel ID="P_HELP_SFTolerance" runat="server" BackColor="#0000CC" 
    Height="218px" Width="404px">
 <asp:UpdatePanel ID="UP2" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False" RenderMode="Inline">
  <ContentTemplate>

                Scale Factor Tolerance has a bandwidth of:<br />
                <br />
                <asp:Image ID="Image2" runat="server" Height="70px" 
                    ImageUrl="~/Resources/tolerance.png" Width="316px" />
                <br />
                <br />

                Lower Bound and Upper Bound can be changed using the textboxes 
        </ContentTemplate>
        </asp:UpdatePanel>
        </asp:Panel>

不幸的是,即使内部有更新面板,按钮点击后页面仍然会重新加载。请指教。提前谢谢。

1 个答案:

答案 0 :(得分:0)

从您的代码中我可以看到BalloonPopupExtenderButton都不在UpdatePanel内。不应该将它们放在UpdatePanel ContentTemplate内吗?

试试这个......

<asp:UpdatePanel ID="UP2" runat="server" RenderMode="Inline">
  <ContentTemplate>

            Scale Factor Tolerance has a bandwidth of:<br />
            <br />
            <asp:Image ID="Image2" runat="server" Height="70px" 
                ImageUrl="~/Resources/tolerance.png" Width="316px" />
            <br />
            <br />

            Lower Bound and Upper Bound can be changed using the textboxes 

<asp:ImageButton ID="B_HELP_SFtolerance" runat="server" BorderColor="Black" 
 BorderStyle="Solid" Height="21px" ImageUrl="~/Resources/1401344600_info6.png" 
 ToolTip="Scale Factor Tolerance Info." Width="25px" />


<ajaxToolkit:BalloonPopupExtender ID="B_HELP_SFtolerance_BalloonPopupExtender"
 runat="server"  BalloonPopupControlID="P_HELP_SFTolerance"
    Position="TopRight" 
    BalloonStyle="Rectangle"
    BalloonSize="Large"
    CustomCssUrl="CustomStyle/BalloonPopupOvalStyle.css"
    CustomClassName="oval"
    UseShadow="true" 
    ScrollBars="Auto"
    DisplayOnMouseOver="false"
    DisplayOnFocus="false"
    DisplayOnClick="true" TargetControlID="B_HELP_SFtolerance" >
    </ajaxToolkit:BalloonPopupExtender>
    </ContentTemplate>
    </asp:UpdatePanel>
相关问题