i want checkboxlist to behave like radiobuttonlist? is it possible? how?
i have list of checkbox and i want that only one checkbox check should be true
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
nishant ranjanPosted Mar 28, 2012, 7:50 AM
Satyapriya NayakPosted Mar 28, 2012, 5:29 AM
Try this...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="checkboxlist_behaveradiobuttonlist._Default" %>
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;
namespace checkboxlist_behaveradiobuttonlist
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
CheckBoxList1.Items[i].Attributes.Add("onclick", "MutExChkList(this)");
}
}
}
}
Thanks