[Mono-aspnet-list] CheckBoxList with autopostback=true does not de-select values

SmoL sergio.miguel.lopes at gmail.com
Wed May 5 07:40:42 EDT 2010


Hello i have a problem with CheckBoxList, everythings works except it doesn't
de-select values, here is a test case with code that works in
Windows/IIS/ASP.NET and doesn't work in Mono, any ideias why it doesn't
work?

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:CheckBoxList ID="CheckBoxList1" runat="server"
EnableViewState="true" AutoPostBack="true"
        onselectedindexchanged="CheckBoxList1_SelectedIndexChanged">
        <asp:ListItem Value="1" Text="Option 1" />
        <asp:ListItem Value="2" Text="Option 2" />
        <asp:ListItem Value="3" Text="Option 3" />
        <asp:ListItem Value="4" Text="Option 4" />
        <asp:ListItem Value="5" Text="Option 5" />
        <asp:ListItem Value="6" Text="Option 6" />
        <asp:ListItem Value="7" Text="Option 7" />
    </asp:CheckBoxList>
    <asp:Literal ID="Literal1" runat="server"></asp:Literal>
    </div>
    </form>
</body>
</html>


using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void CheckBoxList1_SelectedIndexChanged(object sender,
EventArgs e)
    {
        string values = "";
        
        foreach (ListItem li in CheckBoxList1.Items)
        {
            if (li.Selected == true)
            {
                values += li.Value;
                values += ';';
            }
        }

        Literal1.Text = values;

    }
}




-- 
View this message in context: http://mono.1490590.n4.nabble.com/CheckBoxList-with-autopostback-true-does-not-de-select-values-tp2130793p2130793.html
Sent from the Mono - ASP.NET mailing list archive at Nabble.com.


More information about the Mono-aspnet-list mailing list