Click here to Skip to main content
15,899,549 members
Everything / CheckBoxList

CheckBoxList

CheckBoxList

Great Reads

by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
In this blog, we will explore a trick to validate whether any CheckBox inside one CheckBoxList is checked or not.
by Clint Faraday
This article describes how to use CSS to style the following controls: Checkbox, CheckboxList and RadioButtonList.
by DrABELL
This is an alternative for "Using CSS to Style a CheckboxList/RadioButtonList Control in ASP.NET"
by Thiagarajan Rajendran
How to create a checkbox list using simple HTML and jQuery

Latest Articles

by Thiagarajan Rajendran
How to create a checkbox list using simple HTML and jQuery
by DrABELL
This is an alternative for "Using CSS to Style a CheckboxList/RadioButtonList Control in ASP.NET"
by Clint Faraday
This article describes how to use CSS to style the following controls: Checkbox, CheckboxList and RadioButtonList.
by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
In this blog, we will explore a trick to validate whether any CheckBox inside one CheckBoxList is checked or not.

All Articles

Sort by Score

CheckBoxList 

24 Feb 2014 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
In this blog, we will explore a trick to validate whether any CheckBox inside one CheckBoxList is checked or not.
14 Sep 2020 by BillWoodruff
I'm not going to write our code for you, but, I hope I can give you some ideas: 1 to fill the ComboBox with a set of nom duplicate items: // dt is the DataTable // c2 is the #2 DataColumn var cval = dt.AsEnumerable().Select(row =>...
7 Sep 2014 by MukeshSagar
Use the Following Code:private void NavigateRecords() { dRow = _ds.Tables[0].Rows[Inc]; tbUserId.Text = dRow.ItemArray.GetValue( 1 ).ToString(); tbPrimeLoc.Text = dRow.ItemArray.GetValue( 2 ).ToString(); tbUserName.Text = dRow.ItemArray.GetValue( 3 ).ToString(); ...
27 Sep 2014 by George Jonsson
Not sure why you are why you stop one item short of the list count.You should replace this codefor (int i = 0; i
27 Jan 2015 by Member 11174723
ok I found the clicked checkbox value via event.target.innerHTML
27 Jan 2015 by Anisuzzaman Sumon
Let you have a table having data database table named Students as followsID | Roll | Name------------------------1 | 0718004 | Anis------------------------2 | 0718003 | Asad-----------------------3 | 0718002 | Toma-----------------------In...
27 Apr 2015 by Richard Deeming
Start by fixing the SQL Injection[^] vulnerability in your code.You should also wrap the SqlCommand and SqlDataReader objects in Using blocks, to ensure that their resources are always cleaned up.You need to load a single field from your table - don't use SELECT *. You need to store...
2 Jun 2015 by Sergey Alexandrovich Kryukov
Your list items should be the full names of the infected files. You don't have to show the full names in UI. To achieve that, you can create an item class (or struct) with all item information you need for your work and override System.Object.ToString. You will find more detail in my past...
19 Aug 2015 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Make a query to the second table by passing the customer id selected.So you will get two rows. Read the code values one by one by reader. Inside reader, use CheckBoxListId.FindByValue(code) to get the checkbox with that code. Then select it.
23 Oct 2015 by OriginalGriff
Um.Look at your code.I'll compress it a bit...if (A) { ... }else if (A && B) { ... }else if (A && B) { ... } So...if it's not A, what does it do? Nothing...And even if it did have something like the right conditions (and I'm not sure what they are) the conditionally executed...
14 Sep 2020 by Ramtin992
I have database in ms access. I have connected it to C#. The user needs to select a crane type through a combobox. The moment that user selects the item in the combobox I want to have some items related to that choice in a checkedlistbox, which I...
15 Nov 2013 by Member 9492907
How to give the DataTextField and DatavalueField for a CheckBoxList nested inside a Repeater?My repeater control is given below..but it is not working..please help me ...
15 Nov 2013 by Dnyaneshwar@Pune
Use the ItemDataBound event of the Repeater, like this:protected void rep_Comps_ItemDataBound(object sender, RepeaterItemEventArgs e){ CheckBoxList chkList = e.Item.FindControl("chk_chkbx") as CheckBoxList ; if (selectList != null) { chkList.DataSource =...
8 Dec 2013 by Member 10028392
here the dropdown value should have checkbox ....wherein this checkbox should filled from databaseif i select mulitple checkbox it should go and display in dropdownlist and later it should get saved in dropdwonlist?pls give solution
8 Dec 2013 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Refer-1. Dropdown Check List[^]2. Drop Down CheckBoxList control (DropDownCheckBoxes)[^]3. Ajax based multiselect dropdown control[^]
21 Feb 2014 by Member 10379103
I have a checkboxlist that displays all the values from a SQL table's XML field. I can get the list of values to display when only one value is checked but not when more than one record is checked. I think I need to add some logic in my codebehind but am not sure where I need to add the code or...
3 Jun 2014 by NKHari
@using (Html.BeginForm(null, null, FormMethod.Post, new { Id = "form" })){ @Html.DropDownList("Roles",newSelectList((IEnumerable)ViewData["Roles"], "RoleId", "RoleName"), "Select Role", new { @id = "ddlRole" }) ...
25 Jun 2014 by Manish Joshi
I have a Form With Multiple Values For A Common Field "service". I have created an option "Other" For selection. And I want to validate with javascript input field next to "other" option. Code is as followsService You...
25 Jun 2014 by DamithSL
HTMLJavaScript function enable_text(status){ document.getElementById("other_text").disabled = !status;}DEMO[^]EDITif (document.getElementById("Other").checked...
4 Sep 2014 by Member 10994771
how to add checklistbox values into tablelayout in window from c# here is my code cbl.Items.Add(dt.Rows[r]["Option1"].ToString()); cbl.Items.Add(dt.Rows[r]["Option2"].ToString());above two items i want to add them in tablelayoutpanel how to do it. i am...
7 Sep 2014 by Derek Kennard
Hey everyone, I have a problem. I have two checkboxes - cboxMale and cboxFemale. The database values are M and F. What I need to do in C# is run a Stored Proc, return the values, and check the appropriate box based on M or F return. Here's an example of what how I'm bringing in the values....
27 Sep 2014 by Member 10858162
I have two checkboxlists CandidateName and Payment, and a dropdownlist. User can do multiple selections in checkboxlists and one selection at dropdownlist. I am populating those data of chechboxlists and dropdownlist to Panel nested inside UpdatePanel which has gridview and this panel. When I...
29 Sep 2014 by Santhosh Babu Mahimairaj
Insted of loop Use this code . . .this one is liter then loop.. var selectedValues = checkedItem.Items.Cast() .Where(li => li.Selected) .Select(li => li.Value) .ToArray();
26 Jan 2015 by Member 11174723
I have some trouble finding a particular Checkbox. In a dynamic asp.net CheckboxList with approximately 100 Checkboxes, I have a right click context menu and want to get the particular Checkbox on which I opened the context menu.Here is my javascript/JQuery:
27 Jan 2015 by partha143
Hello,I have 2 checkboxlist to which I am populating data from database. The checkboxlist1 get names while the checkboxlist2 get respective roll_number of that names. Now when I check the 2nd name in checkboxlist1, then 2nd roll_number has to get select from checkboxlist2. Thank You
3 Feb 2015 by Tarun Dewangan
I have a checkboxlist which is bound from database and allow single checkbox to select at a time and do postback to display child table record based on selected that single checkbox.
3 Feb 2015 by Peter Leow
Check this out: select a single item in checkbox list using c#[^]Do consider ASP.NET RadioButtonList Control[^]
27 Apr 2015 by kaniption
Hi all,I posted a question yesterday and while I didn't get the precise answer I was looking for, the answers given guided me to the proper resolution so I figured I'd try this again since you're all smarter than I am =)Here's today's issue:I've got multiple tables to store...
18 May 2015 by Aruna Usitha
Hi, i'm doing a little project, it has a feature of marking attendence daily. my attendence table like this.IDNameDatePresent_or_absentso i'm planning to add a checkedlistbox and the names that i ticked have to save in the databse, and the present or absent also should be add...
10 Jun 2015 by Lalyka
when I open the dropdowncheckbox and click "Select all" it selects all and when I uncheck Select all it unchecks all but when I want to check Select all again, it does not check all the optionsI Have a DropDownCheckBoxes
11 Jun 2015 by Lalyka
I just solved itin case someone has the same problemin aspx part AddJQueryReference should be true
19 Aug 2015 by DoomMaker79
Dear All,I'm stuck with my asp.net webform using SQL. I have (let me simplify it for you) 2 tables:table1 has 1 column, named (ID) and data type of 'int'. It has now 61 rows with values of 1...61. Anytime I want to increase the possible values, I have to add it in SQL and not in ASP.NET...
19 Aug 2015 by DoomMaker79
Ok, thanks for your reply, it led me to the solution. It's very simple, I don't know why I couldn't resolve it earlier...So, after querying Table2 I changed the while(dr.Read()) part to this:while (dr.Read()) { ListItem li =...
7 Sep 2015 by Member 11041057
I am using private System.Windows.Forms.CheckedListBox class and I am populating filenames to it.In this checkedlistbox how to color individual items on it.
2 Feb 2016 by Beginner Luck
using stringbuilder http://www.dotnetperls.com/stringbuilder[^]// Declare a new StringBuilder.StringBuilder builder = new StringBuilder();builder.Append(fillcbxl((CheckBoxList)FindControl(v)));
21 Jun 2016 by jitendra raj
I am working on a school ERP project as an ASP.NET web application in which we have a gridview. On my page I want to calculate the sum of cells value row wise of the gridview but the code which I am using returns two or three times the total of the particular column. Any suggestions on how we...
2 Mar 2017 by Eng Abdull A-ziz
hello,how to fill checkbox list with category and sub-category from DBthis is my sql table
2 Mar 2017 by CHill60
Here is an example that gets the category names and status and populates the checkbox - you will need to adapt it to your own needs.I've assumed that category_status equates to true or false - for example it might be a bit column where 0 = false and 1 = true.I haven't faffed around with...
14 Apr 2017 by ammu11
I am not able to save the checked checkbox id to database. Model class is public partial class Mapping { public int Id { get; set; } public Nullable DistrictId { get; set; } public Nullable PostId { get; set; } public List...
11 Oct 2017 by Member 13427678
I have a grid view with multiple columns which allow user to fill in the data and they are able to add a new row after finishing filling the data. Among the columns, there is a column with CheckBoxList which I allow user to multiple select the option on the CheckBoxList but every time add a new...
11 Oct 2017 by Member 10290796
Hi, You need to store the CheckBoxList value in array or jason and then set the checkbox list based on that array since its not a single value, its a set of values which checkboxlist uses. Here is example // Create the list to store. List YrStrList = new List(); // Loop...
30 Jul 2018 by rlgentry
I have a formview with a checkboxlist in edititemtemplate. I want to preselect the items that are in a datatable. How do I do this What I have tried: I have tried setting the checkboxlist items to the datatable in the code behind but I cant find the control.
30 Jul 2018 by love goldsmith
You can try the rowdatabound event to find the control as shown below: protected void formview1_RowDataBound(object sender, GridViewRowEventArgs e) { if(e.Row.RowType == DataControlRowType.DataRow) { Checkboxlist ck= e.Row.FindControl("id_of_checkboxlist") as checkboxlist; } }
30 Jul 2018 by Vincent Maverick Durano
If your database stores a flag to determine the selected CheckBox items, then you could simply do something like: for (int i = 0; i
2 Aug 2018 by dariuskiprotich
I suggest use of jquery to do selecting and unselecting of the checkboxes because 1. It will not result to a postback, 2. You can use checkboxList class -checks- to select all / unselect all. Example: $("input[type='checkbox']").change(function () { if (checkboxname=="checkall") { if...
20 Aug 2018 by Member 9950545
I have to select multiple values from a listbox so I have put a CheckListbox to show multiple values and to select multiple values from the listbox as below protected global::System.Web.UI.WebControls.CheckBoxList CustomerListBox; But on debugging am getting an error as below: 0x800a138f -...
17 Nov 2019 by Member 13132705
I want to fetch data from MS-Access database in window form datagridview based on item selected in checkedlistbox. I am using OLEDB command to connect databse Not using SQl or Sql connection. Data in database in string format. What I have tried: Label1.Text = ""; for (int c = 0; c
27 Feb 2014 by Clint Faraday
This article describes how to use CSS to style the following controls: Checkbox, CheckboxList and RadioButtonList.
16 Mar 2015 by DrABELL
This is an alternative for "Using CSS to Style a CheckboxList/RadioButtonList Control in ASP.NET"
11 Jul 2019 by Thiagarajan Rajendran
How to create a checkbox list using simple HTML and jQuery
17 Nov 2019 by Richard MacCutchan
Loop through your checkboxes and for each one that is set add the appropriate part of your OLEDB statement.
6 Jun 2015 by _Q12_
I have checkedListBox1 control. I want to write into a string "checked3487", ONLY the checked checkboxes text. (the text near the checkbox).When I press one checkbox, "The check state is not updated until after the ItemCheck event occurs", but the "if (e.NewValue == CheckState.Checked)" is...
1 Jun 2015 by naperva
Image my formI'm working on something like antivirus program. I created tex document. And Wrote test, 123, asd. (After the scan its like virus for now.)string[] listName = new String[] { "test", "123", "asd" };After the scan this text document viewed on checkedlistbox. I want to select on...
27 Sep 2014 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
I guess you are dynamically adding items to CheckBoxList from code in Page Load Event.Have you checked IsPostBack? I guess you have not.
6 Mar 2015 by Spirou!
It used to workPreference -> User Interface -> Column/Attribute Visibility -> Completion Checkbox doesn't seems to work
24 Apr 2015 by PIEBALDconsult
How about selecting the XIDTerminal values from the database, putting them in a HashSet, and then testing against the Hashset?
2 Jun 2015 by naperva
There were red lines under the some codes. There were some errors in forms. And I fixed. It working. Thank you.
6 Jun 2015 by _Q12_
Now is working!it was a string manipulation after all. Damn it.I got inspired and I find the solution.here it is: if (e.NewValue == CheckState.Unchecked) { if (checkedList.Contains(checkedListBox1.Items[e.Index].ToString())) { ...
2 Feb 2016 by Member 1473900
I have a search app that has 2 pages and uses a master page. A number of asp.net controls reside on the default page and I need to get their selected values to a label on the results page. I am using a session variable to pass the string built (critString) from the control values to the second...