弹出控件不会保持开放的动作

时间:2013-10-01 19:21:49

标签: asp.net ajaxcontroltoolkit

我正在使用ajaxtoolkit来制作用户可以与服务器控件交互的弹出窗口。这是一个简单的实现:

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="Server" />
<asp:Button ID="Button1" runat="server" Text="Button" />

<ajaxToolkit:PopupControlExtender ID="PopEx" runat="server"
     TargetControlID="Button1"
     PopupControlID="Panel1"
     Position="Center" />

<asp:Panel ID="Panel1" runat="server">
     <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="AppName" DataValueField="PK_Application"></asp:DropDownList>
     <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" SelectCommand="SELECT [AppName], [PK_Application] FROM [Application]"></asp:SqlDataSource>
</asp:Panel>

它似乎工作正常,但当我按下按钮时,面板闪烁然后消失,我无法与之交互。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

解决方案是阻止按钮点击的回发:

protected void Page_Load(object sender, EventArgs e)
{
    Button1.Attributes.Add("onclick", "return false;"); 
}