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

Marek Habersack grendel at twistedcode.net
Wed May 5 09:15:01 EDT 2010


On Wed, 5 May 2010 04:40:42 -0700 (PDT)
SmoL <sergio.miguel.lopes at gmail.com> wrote:

> 
> 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?
It's already fixed in trunk and 2.6 branch

marek
> 
> <%@ 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;
> 
>     }
> }
> 
> 
> 
> 



More information about the Mono-aspnet-list mailing list