Originally I had this problem more than a year ago but recently while developing a fairly robust ASP.NET 1.1 user interface I encuntered it again. This time though I was prepared and also thought that it was worthwhile writing a short post about.
You may have noticed that if you were to nest a Repeater control inside of another databound templated control, the ItemCommand() event does not fire for command buttons such as LinkButtons & ImageButttons that are inside of the Repeater. The reason is that the repeater is not bubbling up the event to the container control.
To solve the problem you can simply create a new class that derives from the Repeater control and override the OnBubbleEvent() method.
Here's the sample code:
Public
Class BubblingRepeater
Inherits System.Web.UI.WebControls.Repeater
Protected Overrides Function OnBubbleEvent(ByVal sender As Object, ByVal e As System.EventArgs) As Boolean
MyBase.OnBubbleEvent(sender, e)
End Function
End
Class
Now to add this control to a web page you'll need a <%@ Register %> directive. Here's a sample:
<%@ Register TagPrefix="MY" Namespace="MyNamespace" Assembly="MyAssembly" %>
Then instead of using an <asp:Repeater> tag in your code you insert a <MY:BubblingRepeater> tag like this:
<MY:BubblingRepeater>
<ItemTemplate>
Your content goes here...
</ItemTemplate>
</MY:BubblingRepeater>
That's it! Oh one last thing. The IDE will give you a warning on the <ItemTemplate> tag saying that "The active schema does not suport the element 'ItemTemplate'". Don't worry about that, it's more trouble to get rid of than it's worth.
Enjoy!