[Mono-devel-list] ImageButton inside Repeater doesn't raise ItemCommand event

Sébastien Macke smacke at perinfo.biz
Tue Jul 26 12:03:31 EDT 2005


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>



More information about the Mono-devel-list mailing list