UserControl
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
UserControl CodeBehind
public partial class WebUserControl : System.Web.UI.UserControl
{
public event EventHandler usrCtrlButtonClick;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
usrCtrlButtonClick.Invoke(this, new EventArgs());
}
}
ASPX Page
protected void Page_Load(object sender, EventArgs e)
{
this.WebUserControl1.usrCtrlButtonClick += new EventHandler(this.usrctrlButtonClick);
}
protected void usrctrlButtonClick(object sender, EventArgs e)
{
Response.Write("From aspx page");
}
If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)
No comments:
Post a Comment