Server controls within a repeater?

T

Tarun Mistry

Hi everyone, a simple problem I hope you guys can help me with.

I have a repeater control, within this i would like to place another server
control.

I.e.

<asp:Repeater id="Repeater1" runat="server">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<asp:Button id="somedynamicid" runan="server"></asp:button>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>

What would be the correct method of doing this? I will need to catch the
onClick event for the button. Im really stumped, advice really appreciated!

Please help,
Thanks

Kind regards
Taz
 
S

Stuart Irving

In ASP.NET 2.0

<asp:Repeater id="Repeater1" runat="server">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<asp:Button id="somedynamicid" runan="server"></asp:button>
<asp:Button id="newButton" runat="server" OnClick="newButton_Click">
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>

The newButton_Click method will run when the button is clicked. If you're
using .Net 1.1 you will need to add an event handler to the button's click
event explicitly.

HTH
 
T

Tarun Mistry

The newButton_Click method will run when the button is clicked. If you're
using .Net 1.1 you will need to add an event handler to the button's click
event explicitly.

HTH

Thanks Stuart!

kind regards,
Taz
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top