<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="MyControls" namespace="MyControls" 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>
</head>
<body>
<form runat="server">
<div>
<!--自定义服务器按钮控件-->
<cc1:MyButton Size-Height="30" Size-Width="290" Text="我是一个单独的提交按钮(自定义服务器)" runat="server" />
</div>
</form>
</body>
</html>
复制代码 代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
//自定义服务器控件
protected void btnSubmit() {
Response.Write("我是自定义服务器控件的点击事件");
}
}