显示页面Html代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>AJAX控件之PopupControl</title>
</head>
<body style="text-align: center">
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
日历:<asp:TextBox ID="TextBox1" runat="server" Width="176px"></asp:TextBox><br />
<asp:Panel ID="Panel1" runat="server" Height="152px" Width="152px">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Calendar ID="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged"
Width="216px"></asp:Calendar>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<br />
<cc1:PopupControlExtender ID="PopupControlExtender1" runat="server" PopupControlID="Panel1"
Position="Bottom" TargetControlID="TextBox1">
</cc1:PopupControlExtender>
</div>
</form>
</body>
</html>cs代码:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
PopupControlExtender1.Commit(Calendar1.SelectedDate.ToString());
}
}


浙公网安备 33010602011771号