Event Handling in Server Controls

I

Iyigun Cevik

I have a server control which contains several LinkButtons like
MyLink = new LinkButton();
MyLink.Text = "Cikar";
MyLink.Click += new EventHandler(this.MyLinkClicked);
Controls.Add( CikarLink );

When i press on link button in webpage, MyLinkClicked function never starts.
I think somebody else handles event but not my server control. I see
something in MSDN like UniqueID, but i couldn't figure out how to make it.
What should i do in order to handle Click event of my LinkButton's in my
server control?
Iyigun Cevik
 
T

Teemu Keiski

Where in your control you wire these events? Does this control implement
INamingContainer interface (is it non-user control)?
 
I

Iyigun Cevik

Yes, it implements INamingContainer.
I have this function in my control class :

private void MyLinkClicked(Object sender, EventArgs e)

and before adding LinkButton to my server control's Controls collection i do
:

MyLink.Click += new EventHandler(this.MyLinkClicked);

but it doesn't work. I mean when i click on button MyLinkClicked function
doesn't run.
Iyigun Cevik
 

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,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top