Answer:
in ascx page
------------------------------------------------------- ascx page start -----------------
In aspx page
in ascx page
------------------------------------------------------- ascx page start -----------------
using System; using System.Data; 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 WebUserControl : System.Web.UI.UserControl { public event EventHandler obj; public string st { get { return this.TextBox1.Text; } } protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { obj(sender, e); } }------------------------------------------------------- ascx page end-----------------
In aspx page
------------------------------------------------------- aspx page start -----------------
protected void Page_Load(object sender, EventArgs e) { WebUserControl1.obj += new EventHandler(Button1_Click); } protected void Button1_Click(object sender, EventArgs e) { Label1.Text = WebUserControl1.st; }
------------------------------------------------------- ascx page end-----------------
Tags :how to caputure user control button click event in aspx page,ascx page,aspx page
0 comments: