.aspx代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="popup.aspx.cs" Inherits="lesson_code_Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type ="text/css">
.pnlPopup { padding:10px; border:1px solid gray; background-color:#eaeaea;}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<myatk:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</myatk:ToolkitScriptManager><%--必要的--%>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<myatk:PopupControlExtender ID="TextBox1_PopupControlExtender" runat="server"
DynamicServicePath="" Enabled="True" ExtenderControlID=""
TargetControlID="TextBox1"
PopupControlID="Panel1"
Position="Bottom"
><%--TargetControlID="TextBox1" 控制方
PopupControlID="Panel1" 弹出方
Position="Bottom"这三个属性的含义要明白--%>
</myatk:PopupControlExtender>
<asp:Panel ID="Panel1" runat="server" CssClass ="pnlPopup">
<p>静态弹出层</p>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:RadioButtonList ID="rblist_1" runat="server" AutoPostBack="True"
onselectedindexchanged="rblist_1_SelectedIndexChanged">
<asp:ListItem >111</asp:ListItem>
<asp:ListItem >222</asp:ListItem>
<asp:ListItem >333</asp:ListItem>
<asp:ListItem >444</asp:ListItem>
</asp:RadioButtonList>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
</div>
</form>
</body>
</html>
.aspx.cs代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class lesson_code_Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void rblist_1_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox1_PopupControlExtender.Commit(rblist_1.SelectedValue);//构建返回值的方法commit
}
}
效果如下: