Events in user control

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?
 
A

Alex Meleta

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
 
M

Masudur

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+=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top