Events in user control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I fire on an event in a user control that gets posted back to the web
form that is hosting the usercontrol?
What is the best way to communicate from a usercontrol to a a webform
hosting the usercontrol?
 
Hi Arne,
How do I fire on an event in a user control that gets posted back to
the web form that is hosting the usercontrol?
http://www.15seconds.com/issue/031023.htm
http://www.odetocode.com/Articles/94.aspx
Advanced info:
http://msdn2.microsoft.com/en-us/library/59t350k3(VS.71).aspx
What is the best way to communicate from a usercontrol to a a webform
hosting the usercontrol?
AJAX. But it very depends on requirement.

Regards, Alex Meleta
[TechBlog] http://devkids.blogspot.com
 
Hi...

its pretty simple declare a public event with appropriate delegate....
public event EventHandler MyButtonClicked;

do fire it like this

protected void GridViewTasks_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//e.Row.Attributes.Add("myCustomAttribute", true);
if (MyButtonClicked!=null)
{
MyButtonClicked(sender, e);
}
}
}

and in page do subscript the event...

myusercontrol.MyButtonClicked+=
 
Back
Top