asp.net RadioButtonList: how to remove list item programmatically
RadioButtonListRemoveItem.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadioButtonListRemoveItem.aspx.cs" Inherits="RadioButtonListRemoveItem" %>
<!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>asp.net RadioButtonList: how to remove list item programmatically</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Fuchsia">RadioButtonList: Remove List Item</h2>
<asp:RadioButtonList
ID="RadioButonList1"
runat="server"
RepeatColumns="3"
ForeColor="DarkMagenta"
BackColor="Orange"
BorderWidth="2"
BorderColor="Crimson"
>
<asp:ListItem>TreeView</asp:ListItem>
<asp:ListItem>Menu</asp:ListItem>
<asp:ListItem>ListItem</asp:ListItem>
<asp:ListItem>DropDownList</asp:ListItem>
<asp:ListItem>CheckBoxList</asp:ListItem>
</asp:RadioButtonList>
<br /><br />
<asp:Button
ID="Button1"
runat="server"
Font-Bold="true"
ForeColor="DodgerBlue"
Text="Remove selected item"
OnClick="Button1_Click"
/>
</div>
</form>
</body>
</html>
RadioButtonListRemoveItem.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class RadioButtonListRemoveItem : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
RadioButonList1.Items.Remove(RadioButonList1.SelectedItem);
}
}
- asp.net XmlDataSource: how to use
- asp.net TreeView: how to use CheckBox in TreeView
- asp.net TreeView: how to use
- asp.net Table: how to add row programmatically
- asp.net RegularExpressionValidator: how to validate email
- asp.net RadioButtonList: how to add list item programmatically
- asp.net ListBox: how to remove multiple list items programmatically
- asp.net ListBox: how to remove list Item programmatically
- asp.net ListBox: how to add List Item programmatically
- asp.net DropDownList: how to remove list item programmatically