events for controls in a Table server control

M

Mark

I have a Table server control with several link buttons. How do I generate
the click events for each of these controls? I can't double click on them
or go into the properties of the linkbuttons to generate the event like I
usually do using VS.NET and C#. I could explicitly type out the event
handler into the InitializeComponent() method, but that usually makes VS.NET
freak out down the line when I start messing with the web designer generated
code.

Suggestions? See the .aspx code below.

<asp:Table id="Table2" runat="server">
<asp:TableRow>
<asp:TableCell>
<asp:LinkButton runat="server" ID="lnkSomeLinkButton">My link
button</asp:LinkButton>
</asp:TableCell>
</asp:TableRow>
</asp:Table>

Thanks in advance.
Mark
 
J

John Saunders

Mark said:
I have a Table server control with several link buttons. How do I generate
the click events for each of these controls? I can't double click on them
or go into the properties of the linkbuttons to generate the event like I
usually do using VS.NET and C#. I could explicitly type out the event
handler into the InitializeComponent() method, but that usually makes VS.NET
freak out down the line when I start messing with the web designer generated
code.

Suggestions? See the .aspx code below.

<asp:Table id="Table2" runat="server">
<asp:TableRow>
<asp:TableCell>
<asp:LinkButton runat="server" ID="lnkSomeLinkButton">My link
button</asp:LinkButton>
</asp:TableCell>
</asp:TableRow>
</asp:Table>

You can add something like this:

lnkSomeLinkButton.Click += new EventHandler(lnkSomeLinkButton_Click);

after the base.OnInit(e); call in OnInit.
 

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

Forum statistics

Threads
473,995
Messages
2,570,235
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top