发布网友 发布时间:2024-10-23 16:34
共1个回答
热心网友 时间:2024-11-02 06:00
test.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="News_System_test" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:CheckBoxList runat="server" ID="test123">
<asp:ListItem>test1</asp:ListItem>
<asp:ListItem>test2</asp:ListItem>
<asp:ListItem>test3</asp:ListItem>
</asp:CheckBoxList>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>
</form>
</body>
</html>
test.aspx.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
public partial class News_System_test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (test123.SelectedItem.Selected.ToString() == "True")
{
test123.Items.Remove(test123.SelectedItem.Text.ToString());
}
}
}