AJAX Control Toolkit——PopupControlExtender(弹出窗口)

本文介绍ASP.NET AJAX中的PopupControlExtender控件使用方法,此控件允许在页面上创建交互式的弹出窗口,展示额外内容并进行复杂的服务器端处理而不影响页面其余部分。文章提供了一个具体的示例代码,展示了如何设置弹出窗口的位置、触发事件等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

PopupControl is an ASP.NET AJAX extender that can be attached to any control in order to open a popup window that displays additional content. This popup window will probably be interactive and will probably be within an ASP.NET AJAX UpdatePanel, so it will be able to perform complex server-based processing (including postbacks) without affecting the rest of the page. The popup window can contain any content, including ASP.NET server controls, HTML elements, etc. Once the work of the popup window is done, a simple server-side call dismisses it and triggers any relevant script on the client to run and update the page dynamically.

TargetControlID——附加到的控件的ID

PopupControlID——弹出显示的控件ID

Position——弹出控件相对目标控件的位置(Left,Right, Top, Bottom, Center)

CommitProperty——目标控件要从弹出控件得到的属性值(可选)

CommotScript——获取弹出控件属性值的脚本

OffsetX/OffsetY——水平、竖直方向距默认位置的偏移距离

Animations

——OnShow

——OnHide

示例代码:

 1 <asp:ScriptManager ID="ScriptManager1" runat="server" />
2 <div>
3 <br />
4 ToDo:
5 <asp:TextBox ID="MyTextBox" runat="server" Width="538px"></asp:TextBox>
6 <br />
7 <asp:Panel ID="Panel1" runat="server" CssClass="popupControl">
8 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
9 <ContentTemplate>
10 <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"
11 Width="146px">
12 <asp:ListItem Text="Scott Guthrie" ></asp:ListItem>
13 <asp:ListItem Text="Simon Muzio"></asp:ListItem>
14 <asp:ListItem Text="Brian Goldfarb"></asp:ListItem>
15 <asp:ListItem Text="Joe Stagner"></asp:ListItem>
16 <asp:ListItem Text="Shawn Nandi"></asp:ListItem>
17 </asp:RadioButtonList>
18 </ContentTemplate>
19 </asp:UpdatePanel>
20 </asp:Panel>
21 <br />
22 <ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server" CommitProperty="value"
23 CommitScript="e.value += ' - SEND A MEETING REQUEST!';" PopupControlID="Panel1"
24 Position="Bottom" TargetControlID="MyTextBox">
25 </ajaxToolkit:PopupControlExtender>
26
27 </div>

简单CSS

.popupControl
{
background-color
:#AAD4FF;
position
:absolute;
visibility
:hidden;
border-style
:solid;
border-color
: Black;
border-width
: 2px;
}

  

转载于:https://www.cnblogs.com/January/archive/2011/08/02/2124563.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值