Click here to Skip to main content
15,894,539 members
Everything / Checkbox

Checkbox

checkbox

Great Reads

by Christoph Buenger
Describes PHP application development with the free Scavix Web Development Framework (Scavix-WDF).
by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
In this blog, we will explore a trick to validate whether any CheckBox inside one CheckBoxList is checked or not.
by Evren Yortuçboylu
A checkbox list jQuery UI widget with real time filtering functionality explained
by rmerca
This is an alternative for "Checkbox List With Filtering jQuery Widget"

Latest Articles

by Thiagarajan Rajendran
How to create a checkbox list using simple HTML and jQuery
by Anshu Krishna
Creating parent/child relations between checkboxes
by Shawn Lawsure
A usable suite of JavaScript UI controls written with TypeScript.
by Christoph Buenger
Describes PHP application development with the free Scavix Web Development Framework (Scavix-WDF).

All Articles

Sort by Score

Checkbox 

31 Oct 2014 by Christoph Buenger
Describes PHP application development with the free Scavix Web Development Framework (Scavix-WDF).
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.
18 Sep 2012 by Evren Yortuçboylu
A checkbox list jQuery UI widget with real time filtering functionality explained
16 Jun 2014 by Nayan Rudani
You may try with: Make Model Description ...
23 Jun 2010 by Prakash.LE
Hi,Try the following: ' OnCheckedChanged="check_changed"/> ...
8 Feb 2011 by #realJSOP
Why don't you use a Listbox instead? You can turn on checkboxes, and when you select an item, just get the item's text. Beyond that, it will look a lot better than having 100 individual listboxes on a form.
8 Jun 2011 by Dave Kreskowiak
It's not that simple. The standard TreeView control in the ToolBox doesn't support doing this natively, so you have to make your own, or find a third party control that does this for you.There's a couple of CP articles that cover doing something like this here[^] and here[^].
11 May 2012 by VJ Reddy
The following code can be used in the Click event of a Button, to find if any of the items in CheckedListBox is available in the ListBox. If available then the boolean flag notFound is set to false.bool notFound = true;checkedListBox1.Items.Cast().Select (s => { if...
24 Sep 2013 by Sergey Alexandrovich Kryukov
Thank you for clarifications (please see the discussion in comments to the question).This is a serious complex questions. The difference between cultures is usually highly underestimated, especially in the West. At the same time, if I understand anything about world cultures (and I, as a...
5 Apr 2016 by Jochen Arndt
Your loop iterates up to (and including) DataGridView3.Rows.Count. Change it to one less:For i As Integer = 0 To DataGridView3.Rows.Count - 1
17 Nov 2016 by Midi_Mick
It looks to me like you're checking the wrong control. The event is attached to checkPOD, but the checkbox you're looking at is checkMoAd.
17 Nov 2016 by OriginalGriff
I'd suspect that it's working every time: it certainly does for me, and I'd be surprised if a bug like that had gone unnoticed for so many years.I suspect that it just isn't doing what you expect because it's not monitoring the same checkbox as causes the event to fire. Try changing it to use...
6 Jan 2011 by Manfred Rudolf Bihy
I'm only guessing here so you'll have to try it out yourself, but it would seem that the item.ToString()1. gives you the name of one of the favorite newspapers and in all the checkboxes the name of the newspaperwould be in the property cb.Text.This is all guesswork as we didn't see the...
31 Mar 2011 by Tarun.K.S
Oh now I know what mistake you did.You are setting the ItemsSource everytime you click it and you have used a List which can replaced with ObservableCollection which can notify you when your collection changed.In the way that I am going to explain below, you don't have to set the...
13 Jan 2012 by bbirajdar
You can do it using jQueryCode sample here http://www.webdeveloperjuice.com/2010/03/15/check-all-uncheck-all-and-invert-checkboxes-using-jquery/For those who want a 'javascript only' solution, here is the link from a CP article http://www.codeproject.com/KB/grid/GridCheckBox.aspx [^]
12 Jan 2012 by NandaKumer
check these blogshttp://wiki.asp.net/404.aspx?aspxerrorpath=/themes/fan/pages/page.aspx/281/check-uncheck-checkboxes-in-gridview-using-javascript/[^]Check/uncheck CheckBox in a GridView using Javascript[^]--NDK
11 Apr 2012 by Not Active
Using JQuery$("selector for checkbox".change(function(){ if($(this).is(':checked') ) $("selector for textarea").show(); else $("selector for textarea").hide();});
21 May 2014 by Peter Leow
Modify this line will do: $tr.find('.chkview').prop('checked', $items.filter(':checked').length >= 1);
21 Nov 2009 by AspDotNetDev
Check out the first result: http://lmgtfy.com/?q=asp.net+checkbox+gridviewAlso, your problem is probably that you are autogenerating columns. Set it to false then create your columns manually. Look here for more information: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gri
3 Feb 2010 by Eddy Vluggen
For a FAT disk, try C:\RECYCLEDFor a NTFS disk, try C:\RECYCLERThere's a hidden text-file in there called "INFO", containing the details of the removed files.--edit--PS: The files are marked with the 'hidden' attributePSS: The INFO-file has been replaced with a "INFO2"-file, located...
21 Jun 2010 by Bhavin Shah - Ember
Hi,I am trying to use the checkbox control inside the repeater. On this checkbox control, i am trying to call server side event for validation purpose.but the call does not go to the server though i have used OnCheckedChanged Event.I am able to get the client side function call...
31 Jan 2011 by Steve Wellens
jQuery could do that on the client side very simply.However, if you want to do it in code behind: protected void...
8 Feb 2011 by Nish Nishant
There are a few issues there:1. The array index starts at 0, not 12. You don't check for array overflow, what if the for loop crosses 100 iterations?3. What's height used for? It's local to the for block and not used for anything4. Define "selected"? You can have a checkbox in...
8 Feb 2011 by Nish Nishant
An alternative approach would be to use a CheckedListBox:http://msdn.microsoft.com/en-us/library/system.windows.forms.checkedlistbox.aspx[^]
9 Feb 2011 by Member 7659437
Can you please give me an example code in JavaScript on how to keep the state of a checkbox by creating cookie when I refresh the page?I have something as the following but I couldn't manage have it run as I expected. I am new in JavaScript./*** Simple interface to cookie...
14 Aug 2011 by Abhinav S
rm_no is most likely not the same object as the one you have in the list box.Thus the object you are trying to remove is not present in the listbox item set.
5 Apr 2012 by Prasad_Kulkarni
Try this:For C#:private void SelectAllCheckBoxControls(Control parent,bool checkedVal) { try { string strLeave=string.Empty; foreach (Control child in parent.Controls) { if...
8 Sep 2012 by __TR__
You can use the focus() method in JavaScript.Here is a sample code. function setFocus() { var checkbox = document.getElementById(''); var Textbox = document.getElementById(''); ...
18 Sep 2012 by Bob Brady
I've searched all over for this - while there is PLENTY on binding a checkbox, I couldn't find anything on programmatically setting the box as checked, and the solutions that I thought I'd found didn't work.The XAML:
31 Oct 2012 by FabeCode
I have a gridview that, from within the code behind, I bind to a DataTable and programmatically populate number of rows and cell values.When I click on a checkbox that has AutoPostBack set to true, the gridview resets. Since the events for the checkbox are executed only when its...
8 Dec 2012 by Crispanvarro
I can clear all the text boxes when i press reset button ,ie, txtName.text = "".. i can clear the combo boxes in the same way,but how do i reset the radiobuttons,checkboxes and listbox contents that have been selected.
8 Dec 2012 by Krunal Rohit
Its C# code, I've solved yesterday similar kinda question :private void button1_Click_1(object sender, EventArgs e) { List t = new List(); t.Add(textBox1); t.Add(textBox2); t.Add(textBox3); ...
28 Dec 2012 by Jibesh
Check the Checked Property of the menu items added to the strip. please note that you cannot add CheckBox behavior to the top level menu but to child items.
8 May 2013 by CHill60
This will fire regardless of which checkbox is clicked but shows you how to work out which one it wasprivate void CheckBoxCheckedChanged(object sender, EventArgs e){ CheckBox c = (CheckBox)sender; MessageBox.Show(c.Name);}... and will only fire for the checkbox that was just...
31 May 2013 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
I think you need to prevent the default behaviour of click event using event.preventDefault()[^] method.Check the Demo - [Demo] Prevent Default Behaviour of CheckBox Click.[^]
6 Jun 2013 by rmerca
This is an alternative for "Checkbox List With Filtering jQuery Widget"
17 Jul 2013 by Maciej Los
First of all, i would suggest you to NOT use insert/update/delete statements in code. Have you ever heard about SQL injection[^]? Better way is to use stored procedures[^].Second, you need to declare variable (for example) oCell, type: DataGridViewCheckBoxCell. Then you need to cast...
9 Sep 2013 by Joezer BH
Try Environment.NewLinedxchkIsDependentField1.Text = "Calculated field cannot be " + Environment.NewLine + " marked as dependant field";Cheers, Edo
10 Sep 2013 by Sergey Alexandrovich Kryukov
Please see my comments to the question. All you need is this:http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.value.aspx[^],http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.valuetype.aspx[^].What is "click on the instant"? Anyway,...
21 Sep 2013 by Rahul Krishnan R
Hi,I have a datagridview with a check box column as the first column in it.I want the users to select multiple check boxes and on a button click event, an SQL update query should be executed based on the values from the second column of the datagridview. Example query : Update table...
13 Oct 2013 by OriginalGriff
Simple: Arrays run from 0 to count -1Try: For x = 0 To lvsettings.Items.Count -1Instead.
27 Nov 2013 by 7045Jeegnesh
I have 1350 City to fill in the table as check box list.and I made it..Now When press next button with selecting few city among 1350.it working as per programmed.but, if i select all of them to make next step with the all city then it's fire error."...
23 Jan 2014 by arindamrudra
Just give the same name to the checkbox like for all you should use below.Now when you are submitting the page, just use the FormCollection and use the key...
28 Mar 2014 by Randor
Hi,Have a look at the NMCUSTOMDRAW structure[^]. You should be checking the value of uItemState. Note that the MSDN entry says: 'This value is a combination of the following flags.'. This is a hint that you should not be checking by-value... but rather for (bitmask & value).Best...
19 Apr 2014 by Manas Bhardwaj
First, you need to understand Http is a stateless protocol[^]. So, what you have done in previous page is not available anymore until and unless you implement something (using query strings, session, cache etc.) to have that state persisted and transferred to another page. You can google...
19 Apr 2014 by Thanks7872
First of all, everyone here is volunteer who work on their time. This can be urgent for you but not for others. Don't ask questions like this one as it won't help you but response will be very less.Further, change the way you think. You are not suppose to access page controls from other...
16 May 2014 by DamithSL
try below $('.chkSelectAll').change(function () { $('.chkNumber').prop('checked', $(this).is(':checked'));});$(".chkNumber").change(function () { $('.chkSelectAll').prop('checked', $('.chkNumber:checked').length == $('.chkNumber').length);});DEMO[^]
15 Jun 2014 by DamithSL
You can bind like below' >This will fail if Eval("column") not return boolvalue. for example Checked='' will convert to bool value and set it as checked...
27 Jan 2015 by Member 11174723
ok I found the clicked checkbox value via event.target.innerHTML
22 Jun 2015 by Mahatma Aladdin
I have created a webform which imports the excel file into gridview. Now I want to add checkbox control to each header (along with the header text).Below is the code where I am 1. Importing the excel data. 2. Store it into a datatable 3. Creating gridview dynamically 4. Binding the data into...
21 Aug 2015 by xszaboj
Hi, I edited your jsfiddle, not sure if that is exactly what you need, but I hope it will help.http://jsfiddle.net/5L7q4dsc/[^]check/uncheck:http://jsfiddle.net/mcptsuto/[^]
24 Sep 2015 by Palash Mondal_
Firstly, remove the loop inside the change event as its resetting the ischecked value each time and use it like:$("#Checkboxlist1 :checkbox").change(function () { var ischecked = $(this).is(":checked"); var val = $(this).val(); //alert(val); if (val == "Select All") { ...
11 Jan 2016 by Richard MacCutchan
It should really crash your app. You create a new instance of class1, try to click a checkbox in it which you have not yet created, then leave this method, at which time this object gets deleted. You need to select the checkbox that exists on the screen, and in your original object, that you...
11 Jan 2016 by Roland 57
The problem is: class1 is not fully instantiated yet.You should use Swingutilities.invokelater(...).
12 Jan 2016 by Roland 57
package test;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JCheckBox;import javax.swing.JFrame;/** * * @author Roland */public class Test { private static class A extends JFrame { ...
11 May 2016 by CHill60
Remove the line dataGridView1.ReadOnly = true;[EDIT] - Came back to this. It occurred to me that you don't want the user overtyping any of the other columns. So definitely remove the line I mentioned above, but control which of the columns can be adjusted like...
2 Jan 2017 by Ralf Meier
you could also write :CheckBox1.Checked = (Rs("Medical").Value.toString.toLower = "yes") Was this your Problem ...?
2 Jan 2017 by Peter Leow
Instead ofif Rs("Medical").Value = "Yes" Or "yes" Thenit should beIf Rs("Medical").Value = "Yes" Or Rs("Medical").Value = "yes" ThenIf possible, you should clean up the database.Minimally, try to look for that script that is responsible for inserting such vague values and make it...
23 Mar 2017 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Actually you have to store those selection when you click on next page. Use localstorage, cookie or something to store the ids. When you come back to the page, try to select those ids again.
16 Apr 2017 by Bryian Tan
I think the easiest way is to change the source to output Yes/No instead of true/false. But, if that not doable, you also can write code to manipulate the DataTable(I'm assuming table = DataTable). Here is an example, is not type safe, but you can enhance it. The below function will change the...
17 May 2017 by AnvilRanger
You really have a couple of options and the right one depends on what you are doing in your CheckedChanged event. 1. Set AutoPostBack to True, let the page complete its PostBack and handle any logic that needs to be done. 2. Possibly look at placing your grid in an UpdatePanel. You can then...
17 May 2017 by F-ES Sitecore
You need to get a better understanding on web and asp.net architecture. Your server code only runs to generate html\js which is then sent to the client to execute, your .net code isn't running inside the browser, it can't respond to client events. It can only run when you do a postback which...
11 Dec 2017 by Leo Chapiro
Do it step by step: first look how the timer works. Forget about writing to excel, that is another task that is not depending on timer's task for now. So you would now initialize your timer, start it by click-on the check box and stop it by click-off the check box and write the current time on...
5 Jun 2018 by Dave Kreskowiak
Your problem is that you don't need the second if statement at all. If the checkbox is not true, it must be false. if (sexch.Checked == true) { ch.Text = "Male"; } else { ch.Text = "Female"; }
16 Feb 2021 by Richard Deeming
If I've understood what you're trying to do, something like this should work: ...
6 Dec 2021 by Chris Copeland
Given that your checkboxes all have an id attribute beginning with "checkbox-" you can use the CSS "starts with" selector to pick the checkboxes up. In addition you can use the ":checked" selector. For jQuery the script would look like:...
14 Jun 2022 by Fydobas
You could actually do this in a much simpler way; you could simply loop through the DataGridView's rows and iterate an integer variable every time you find a row which value for the field in question is equivalent to 1 (or larger than zero, for...
16 Jun 2022 by OriginalGriff
Without your data and your code running as you have it, we can't really tell when is going on at all. So, it's going to be up to you. Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. If...
16 Jun 2022 by RickZeeland
Change: else row.Selected = false; BtnCancel.Enabled = true; btnUpdate.Enabled = true; btnDelete.Enabled = true; Into: else { ...
22 Apr 2023 by OriginalGriff
From just that scrap of code, we can't tell - but at a guess it's because of how web pages work: are you checking to see if this is a postback in your page load event handler? Because if you aren't, then when the user checks his boxes and clicks...
12 Oct 2023 by OriginalGriff
We can't help you - we have no access to your data, and it is very much crucial to how that code runs. So, it's going to be up to you. Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. If...
31 Oct 2023 by Richard Deeming
If you view the rendered HTML in your browser, you will see that you have generated an onclick attribute that looks something like: Clearly, regardless of...
18 Jan 2010 by udayalkonline
hi,I have a gridview with checkbox field.I want to delete a record when checked a ckeckbox and click on delete button.what will be the way that Should I follow to achive this.Thank you.
18 Jan 2010 by thatraja
try this. please man just search in search engines before asking here. This one is 3rd link in google with keyword "gridview with checkbox"
31 Mar 2010 by technette
thank you very much for responding.I'm getting errors on the syntax for the text and the dropdownlist.How should the syntax for the dropdownlist be stated?
10 Jun 2010 by Randall Hall
I'm trying to change a the colors and font of a row in a gridview by the state of a checkbox.I have a databound gridview that has a cancelled checkbox. I would like to change the text to red and font to strikethrough when the box is checked. I would like to do this without Java if...
10 Jun 2010 by Arindam Tewary
If you want to set color/style of row/rows from Code behind file then please remove Color/style set in HTML view. Color/Style which are mentioned HTML is basically overwrites color/style set from code behind.Please let me know if it helps you,
28 Jul 2010 by zeebo17
Hi, I have created a check box in VC++ but I'm not sure how to retrieve the information from it. Do I assign it a variable that is a BOOL OR CButton? I have tried to assign it the variable BOOL m_Check_Box and I've added the event handler DDX_Control(pDX, IDC_displaydepthline,...
28 Jul 2010 by #realJSOP
Well, you misspelled the variable name for one thing. In the event handler, you use m_CheckBox, but you're trying to retrieve the control's staete using m_Check_Box.
28 Jul 2010 by Sauro Viti
You can do it in two ways:Add a member variable of type CButton, let's say it's named m_btnCheck, then add in your DoDataExchange the following:DDX_Control(pDC, IDC_displaydepthline, m_btnCheck);And finally in your handler:void CCleanViewDlg::OnBnClickeddisplaydepthline(){ BOOL...
18 Aug 2010 by ahiggins1986
Hello,This problem seems so trivial, yet it is causing me a big headache. I have 4 checkboxes in my custom control, which I use to control which subsets to show on a graph. When any of these CheckBoxes' Checked property is changed, it fires an event handler.The problem is that the...
17 Aug 2010 by Abhi Lahare
Please take a look at this article.HTHAn OwnerDraw ComboBox with CheckBoxes in the Drop-Down[^]
24 Aug 2010 by Christian Graus
Process.Start(...
24 Aug 2010 by Nuri Ismail
"I have searched all over the Internet for a Chat Bot" - rush44Did you search the articles on CodeProject? Have a look at these results[^].
24 Nov 2010 by sujeet101
First , Go to the datagridview column property and set the columntype to datagridviewcheckboxcolumn it adds the checkbox columns in to ur datagrid view,then add Rows as per u required u can use it for adding Rows--> DataGridview1.Rows.Add(no. of rows); //e.g (5)
2 Dec 2010 by erummirza
problem has been resolved , i already did it
3 Dec 2010 by erummirza
ok now that problem has been "reslolved" now i need to put certain validation in that means at least one Packages must be selected with either single or double rooms so behind submitt button i write follwoing code 'get how many packages hav been selected Dim c As Int32 ...
3 Dec 2010 by erummirza
'get how many packages have been selected Dim c As Int32 Dim str As String For Each dataItem As RepeaterItem In Repeater1.Items Dim ckchecked As CheckBox = DirectCast(dataItem.FindControl("chk_packages"), CheckBox) If ckchecked.Checked...
3 Dec 2010 by Dave Kreskowiak
If you got "Object reference not set to an instance of an object", something didn't return a class instance, like FindControl probably didn't really find your control.Your quite clear in the problem, it's your code that is nearly incomprehensible.
5 Jan 2011 by tyu
i have a checkboxlist populated from a datasource which contains all newspapers. a second datasource which i want to view and compare its select data, contains favorites newspapers. i want checkboxes preselected according to newspaper ids from the second datasources. its select method...
6 Jan 2011 by Nguyennamhsm
I want to create a checkboxlist to select items. When I select a row in this list, it will be invisible and visible in other controlLike at FACEBOOKPlease, help me!http://ca9.upanh.com/19.0.23590835.3lO0/facebook.jpg
6 Jan 2011 by Sandeep Mewara
Better you use AJAX for smooth view.On selection changed event, you need to rebind both the lists with updated dataset.
31 Jan 2011 by deepak2prince
how to uncheck all check boxes in repeater data control , other than the one being checked?
31 Jan 2011 by Not Active
There is nothing out of the box that will do this but it can be accomplished easily with some javascript, for which there are many examples available
5 Feb 2011 by Anupama Roy
I think you need to convert the data to be send/receive as byte array.That's how it works when you send/receive data over the network.The below article clearly explains this.Take a look.TCP/IP Chat Application Using C#[^]
9 Feb 2011 by Member 7659437
I have multiple checkboxes on the page. I want to maintain their states every time I visit the page.Thanks,
2 Mar 2011 by Ramalinga Koushik
In aspx C#if (CheckBox1.Checked){ //your actions}Hope this might help you.
3 Mar 2011 by Baji Jabbar
use Javascript to hide/show the control.document.getElementById("").style.visibility="hidden";