[Mono-devel-list] ASP.NET Repeater + subitem events that update the underlying item, manual refresh necessary, bug?

Sebastian Nowozin nowozin at gmail.com
Thu Nov 25 00:02:46 EST 2004


Hi everybody,

I am really satisfied with the ASP.NET implementation by the Mono
team, but in the last few days have worked around a problem which I am
not sure if its a bug in the implementation or a misunderstanding of
the event model of ASP.NET on my side.

The basic files I have:

ImageSizerControl.ascx, defining a control to resize images
size.aspx, a list of images, using ImageSizerControl in a Repeater
(details below)
Size.cs, the underlying .cs file

The code in size.aspx looks like:

<form id="ImageForm" runat="server">
<asp:Repeater id="ImageRepeater" runat="server" >
    <HeaderTemplate><table></HeaderTemplate>
    <ItemTemplate>
    <tr><td>
        <ImageSizer:sizer
            Order="<%# Container.DataItem %>"
            runat="server"/>
    </td></tr>
    </ItemTemplate>

    <FooterTemplate>
    </table>
    </FooterTemplate>
</asp:Repeater>
</form>

Which properly creates a list of the databound items, given to the
ImageSizerControl object through the property "Order". Within the
ImageSizerControl's Order set accessor, it does something like:

            lblWidth.Text = String.Format ("{0:F2}", order.DimensionWidth);
            lblHeight.Text = String.Format ("{0:F2}", order.DimensionHeight);

Now, the repeater is initialized in the OnInit method of the
size.aspx's underlying Size.cs file:

        override protected void OnInit (EventArgs ev)
        {
            ImageRepeater.DataSource = Orders;
            ImageRepeater.DataBind();

Where Orders is an ArrayList.  The display works perfectly, and the
generated html looks clean.

Now for the problem. I run Debian/sid, mono 1.0.2, mod_mono with apache 1.3.x

Problem: I would like to define buttons/events to be handled in the
ImageSizerControl.  This indeed works straightforward, and I just
define a button control and update some property of the underlying
DataItem in its OnClick event handler, for example
order.DimensionWidth in the event handling code in the
ImageSizerControl. But this change is not reflected in the generated
html. Only after I press the button and then manually reload the page,
the change is reflected and the display is correct.

So, my question to all the ASP.NET gurus on this list: is this normal
or do I have to manually enforce a refresh/complete-regeneration of
the html output? (In case the latter is true, how to do it?).

Thanks in advance,
Sebastian



More information about the Mono-devel-list mailing list