用户控件的点击问题,急!!!
一个用户控件,包括2个button,如何在调用它的页面写点击事件?
用户控件:
mybutton.ascx
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="MyButton.ascx.vb" Inherits="GrandUnited.MyButton" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<TABLE align="center" cellpadding="0" cellspacing="0" border="0">
<TR align="center">
<TD width="70"><ASP:BUTTON runat="server" id="ButtonOK" height="25" width="60"></ASP:BUTTON></TD>
<TD width="20"></TD>
<TD width="70"><ASP:BUTTON runat="server" id="ButtonNO" height="25" width="60"></ASP:BUTTON></TD>
</TR>
</TABLE>
mybutton.ascx.vb
Public Class MyButton
Inherits System.Web.UI.UserControl
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents ButtonOK As System.Web.UI.WebControls.Button
Protected WithEvents ButtonNO As System.Web.UI.WebControls.Button
'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
End Sub
Public Property OK_Name() As String
Get
Return ButtonOK.Text
End Get
Set(ByVal Value As String)
ButtonOK.Text = Value
End Set
End Property