[Mono-list] Bug in ASP.NET? Please take a look.
Maurizio Colucci
seguso.forever@tin.it
Thu, 26 Jun 2003 12:30:34 +0200
Hello,
this seems like a bug in asp.net postback mechanism.
I'm using mono 0.24 from debianplanet packages, and xsp from cvs.
To reproduce the bug:
1. in xsp, start the following aspx page.
2. Select an exam, e.g. "calculus".
3. Click "view subscriptions". The list of subscription correctly appears.
4. Now click "view subscriptions" again, _without_ changing the
selection (i.e. leave "calculus" selected). An error message appears,
complaining that there was no exam selected. But it was!
Am I doing somehting wrong, or is it a mono bug?
<%@ language="C#" %>
<script runat="server" >
void Page_Load(Object Source, EventArgs E) {
if (!IsPostBack){
#region fill the listbox exams
exams.Items.Clear();
exams.Items.Add(new ListItem( "math"));
exams.Items.Add(new ListItem( "calculus"));
exams.Items.Add(new ListItem( "english"));
message_subscriptions.Visible=false;
subscriptions.Visible=false;
#endregion
}
else{
if (exams.SelectedIndex >=0){
message_subscriptions.Visible=true;
subscriptions.Visible=true;
message.Text="";
message_subscriptions.Text = "Subscriptions to \"" + exams.SelectedItem.Text + "\" are:";
subscriptions.Items.Clear();
subscriptions.Items.Add(new ListItem( "John"));
subscriptions.Items.Add(new ListItem( "Jack"));
}
else{
message.Text = "<h2>Error: no item selected. SelectedIndex = " +
exams.SelectedIndex + " </h2>";
}
}
}
</script>
<html>
<body>
<asp:label id=message runat=server ForeColor=red/>
<h1>Mono test page</h1>
Select an exam, then click "view subscriptions".
<form runat=server>
<p><asp:listbox id="exams" runat=server />
<p> <input type=submit value="View subscriptions">
<p><asp:label id="message_subscriptions" runat=server />
<p><asp:listbox id="subscriptions" runat=server />
</form>
</body>
</html>