aspx页面
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Test_Default" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<!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">
*{padding:0;margin:0;font-size:12px;}
.modalBackground
{
background-color:#ccc;
filter:alpha(opacity=70);
opacity:0.7;
}
.modalPopup
{
background-color:#ffffdd;
border-width:3px;
border-style:solid;
border-color:Gray;
padding:3px;
width:250px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Panel ID="Panel1" runat="server" >
<div class="modalPopup">
Please Input Your Name:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br /><br/>
<asp:Button ID="btnAgree" runat="server" Text="Agree"
onclick="btnAgree_Click" style="display:none"/>
<asp:Button ID="Button1" runat="server" Text="Button1"
onclick="btnAgree_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</div>
</asp:Panel>
<cc1:ModalPopupExtender ID="Panel1_ModalPopupExtender" runat="server"
BackgroundCssClass="modalBackground"
Enabled="True"
TargetControlID="LinkButton1"
PopupControlID = "Panel1"
OkControlID = "btnAgree"
CancelControlID = "btnCancel"
DropShadow="true"
>
</cc1:ModalPopupExtender>
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
</form>
</body>
</html>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<!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">
*{padding:0;margin:0;font-size:12px;}
.modalBackground
{
background-color:#ccc;
filter:alpha(opacity=70);
opacity:0.7;
}
.modalPopup
{
background-color:#ffffdd;
border-width:3px;
border-style:solid;
border-color:Gray;
padding:3px;
width:250px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Panel ID="Panel1" runat="server" >
<div class="modalPopup">
Please Input Your Name:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br /><br/>
<asp:Button ID="btnAgree" runat="server" Text="Agree"
onclick="btnAgree_Click" style="display:none"/>
<asp:Button ID="Button1" runat="server" Text="Button1"
onclick="btnAgree_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</div>
</asp:Panel>
<cc1:ModalPopupExtender ID="Panel1_ModalPopupExtender" runat="server"
BackgroundCssClass="modalBackground"
Enabled="True"
TargetControlID="LinkButton1"
PopupControlID = "Panel1"
OkControlID = "btnAgree"
CancelControlID = "btnCancel"
DropShadow="true"
>
</cc1:ModalPopupExtender>
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
</form>
</body>
</html>
后端cs内容:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
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 Test_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnAgree_Click(object sender, EventArgs e)
{
LinkButton1.Text = this.TextBox1.Text;
}
}
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
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 Test_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnAgree_Click(object sender, EventArgs e)
{
LinkButton1.Text = this.TextBox1.Text;
}
}