Connecting Tech Pros Worldwide Forums | Help | Site Map

Event Handling in Server Controls

Iyigun Cevik
Guest
 
Posts: n/a
#1: Nov 18 '05
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






Teemu Keiski
Guest
 
Posts: n/a
#2: Nov 18 '05

re: Event Handling in Server Controls


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

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist


"Iyigun Cevik" <iyigun@mirabilisim.com> wrote in message
news:Ol5lWCLtDHA.2304@tk2msftngp13.phx.gbl...[color=blue]
> 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[/color]
starts.[color=blue]
> 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
>
>
>
>
>[/color]


Iyigun Cevik
Guest
 
Posts: n/a
#3: Nov 18 '05

re: Event Handling in Server Controls


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


"Teemu Keiski" <joteke@aspalliance.com> wrote in message
news:ej3IytLtDHA.2492@TK2MSFTNGP12.phx.gbl...[color=blue]
> Where in your control you wire these events? Does this control implement
> INamingContainer interface (is it non-user control)?
>
> --
> Teemu Keiski
> MCP, Microsoft MVP (ASP.NET), AspInsiders member
> ASP.NET Forum Moderator, AspAlliance Columnist
>
>
> "Iyigun Cevik" <iyigun@mirabilisim.com> wrote in message[/color]
news:Ol5lWCLtDHA.2304@tk2msftngp13.phx.gbl...[color=blue][color=green]
> > 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[/color]
> starts.[color=green]
> > 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[/color][/color]
it.[color=blue][color=green]
> > What should i do in order to handle Click event of my LinkButton's in my
> > server control?
> > Iyigun Cevik[/color][/color]


Closed Thread