User web control event

V

Velislav

Hi, i have the following situation:
I have a user control which contains a repeater.
Each repeater item contains a LinkButton
I want the user control to fire an event whenever the LinkButton is
clicked, with a custom EventArgs class which holds the ID of the item
for which the button was clicked.

So have the following bits of code:

public class StructureBrowseListItemClickedEventArgs : System.EventArgs
{
public StructureBrowseListItemClickedEventArgs(int structureID)
{
this.StructureID = structureID;
}
public readonly int StructureID;
}

public delegate void StructureBrowseListItemClickedHandler(object
sender, StructureBrowseListItemClickedEventArgs e);

..
..
..

public partial class StructureBrowseList : System.Web.UI.UserControl
{
public event StructureBrowseListItemClickedHandler
StructureBrowseListItemClicked;
 
M

Masudur

Velislav said:
Hi, i have the following situation:
I have a usercontrol which contains a repeater.
Each repeater item contains a LinkButton
I want the user control to fire an event whenever the LinkButton is

Hi,

If the event of the control is not been subscribled it returns null.
You must be using this user control in some page or content holder.

Usercontrol.StructureBrowseListItemClickedHandler+= new
StructureBrowseListItemClickedHandler(funtionName);

Try Subscribing the event.

Masudur
Kaz Software Ltd.
www.kaz.com.bd
 
V

Velislav

Thanks, makes perfect sense :)
Hi,

If the event of the control is not been subscribled it returns null.
You must be using this user control in some page or content holder.

Usercontrol.StructureBrowseListItemClickedHandler+= new
StructureBrowseListItemClickedHandler(funtionName);

Try Subscribing the event.

Masudur
Kaz Software Ltd.
www.kaz.com.bd
 

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

Top