Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Events in user control

Reply
Thread Tools

Events in user control

 
 
=?Utf-8?B?QXJuZSBHYXJ2YW5kZXI=?=
Guest
Posts: n/a
 
      07-13-2007
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?
--
Arne Garvander
(I program VB.Net for fun and C# to get paid.)
 
Reply With Quote
 
 
 
 
Alex Meleta
Guest
Posts: n/a
 
      07-13-2007
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/lib...k3(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


 
Reply With Quote
 
 
 
 
Masudur
Guest
Posts: n/a
 
      07-14-2007
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+=

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Control to Control Other User Control Jonathan Wood ASP .Net 4 02-02-2010 03:41 PM
Differentiate between user caused events and script generated events jmpinchot@gmail.com Javascript 1 04-27-2007 03:05 AM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM
Events for menu user control using ie web control Sunkam Santhoshi ASP .Net 0 12-16-2003 09:50 AM



Advertisments