ModalPopupExtender用法示例

简介: aspx页面 DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.

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 >


后端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;
       
    }

}

目录
相关文章
|
3月前
|
数据安全/隐私保护
关于DotNetZip的用法
关于DotNetZip的用法
20 0
|
4月前
|
机器学习/深度学习 数据可视化 API
Gymnasium的基本用法
Gymnasium的基本用法
86 0
|
5月前
LambdaQueryWrapper用法
LambdaQueryWrapper用法
|
存储 API 索引
CImageList用法介绍
CImageList用法介绍
128 0
propertyIsEnumerable的用法
propertyIsEnumerable用法 语法和功能 obj.propertyIsEnumerable(prop): 判断prop属性是否是obj的可枚举属性
157 0
|
数据安全/隐私保护