1
<
asp:Button
ID
="Button1"
runat
="server"
Text
="查 询"
OnClick
="BtnQuery_Click"
/>
2
2
用户控件.ascx.cs
1
public
event
EventHandler BtnEvent;
//
添加事件句柄
2
3 protected void BtnQuery_Click( object sender, EventArgs e)
4 {
5
6 slLabel.Text = " 共查询到 " + sl1 + " 条符合条件的记录 " ; // 按钮自己的事件处理语句
7
8 // 判断是否被订阅
9 if (BtnEvent != null )
10 {
11 BtnEvent( this , new EventArgs());
12 }
13 }
2
3 protected void BtnQuery_Click( object sender, EventArgs e)
4 {
5
6 slLabel.Text = " 共查询到 " + sl1 + " 条符合条件的记录 " ; // 按钮自己的事件处理语句
7
8 // 判断是否被订阅
9 if (BtnEvent != null )
10 {
11 BtnEvent( this , new EventArgs());
12 }
13 }
页面.aspx
<
uc1:SjrwsCx
id
="SjrwsCx1"
runat
="server"
OnBtnEvent
="SjrwsCx1_Click"
>
</
uc1:SjrwsCx
>
页面.aspx.cs
1
protected
void
SjrwsCx1_Click(
object
sender, System.EventArgs e)
2 {
3 //处理语句
4 }
2 {
3 //处理语句
4 }