[Mono-devel-list] ImageButton inside Repeater doesn't raise ItemCommand event
Rafael Teixeira
monoman at gmail.com
Wed Jul 27 17:33:48 EDT 2005
See the first answer in this forum thread:
http://forums.asp.net/941132/ShowPost.aspx
>From it, looks like you missed the CommandName attribute in the
asp:ImageButton tag. Without it there nothing to link your button to
some command (you can have many of them in the same template) and so
the event isn't raised.
:)
On 7/26/05, Sébastien Macke <smacke at perinfo.biz> wrote:
> Hi,
>
> I've just noticed that when using an ImageButton inside a Repeater,
> clicking it won't get me into MyRepeaterCommand() function (see the code
> below).
>
> I'm using mono-1.1.8.20050725 nightly.
>
> Is it gonna be a bug?
>
> Source:
> <%@ Page Language="C#"%>
> <%@ import Namespace="System.Data" %>
> <script runat="server">
>
> public void Page_Load(object sender, EventArgs e)
> {
> InitMyRepeater();
> }
>
> void InitMyRepeater()
> {
> DataTable dt = new DataTable();
>
> dt.Columns.Add("ItemNumber", typeof(string));
>
> for(int i=0; i<10; i++)
> {
> dt.Rows.Add( new object[]{"Item n°" + i.ToString() } );
> }
>
> MyRepeater.DataSource = dt;
> MyRepeater.DataBind();
> }
>
> void MyRepeaterCommand(Object pSender, RepeaterCommandEventArgs pEvent)
> {
> Console.WriteLine("Test");
> }
>
> </script>
>
> <html>
> <body>
> <form runat="server">
> <asp:Repeater id="MyRepeater" OnItemCommand="MyRepeaterCommand"
> runat="server">
> <ItemTemplate>
> <%# DataBinder.Eval(Container.DataItem, "ItemNumber") %>
> <asp:ImageButton Text="Click Me" runat="server"/>
> </br>
> </ItemTemplate>
> </asp:Repeater>
> </form>
> </body>
> </html>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
--
Rafael "Monoman" Teixeira
---------------------------------------
I'm trying to become a "Rosh Gadol" before my own eyes.
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
It hurts!
More information about the Mono-devel-list
mailing list