Click here to Skip to main content
12,956,918 members (58,349 online)
Click here to Skip to main content
Add your own
alternative version


16 bookmarked
Posted 1 Jul 2008

Customize CheckBox in ASP.NET

, 4 Feb 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
Customize checkbox control in ASP.NET


I was working on a project in which I need a customize checkbox. I wanted to use an image for checkbox. I Googled, but could not find a solution for customize checkbox for ASP.NET checkbox control. The idea is that I want to write a code which makes an ASP.NET checkbox control customizable without writing any code in checkbox control.


There are many solutions and articles present on the net for customize checkbox. But all of them work in HTML control. For each checkbox, you need to set a JavaScript function.

Using the Code

I have created this code to work with checkboxlist control. It is very easy to implement, drag any number of checkboxes on the page. Rest of the work will done by JavaScript code.

View online demo.

In the body tag, call the setup() function:

<body onload="setup()">

function setup()
 var inputs=document.getElementsByTagName ("input")
 for(var i = 0; i < inputs.length; i++)
     case "checkbox":
         inputs[i].nextSibling.innerHTML="<img src=" + inputs[i].nextSibling.innerHTML;
			"<img src="+ inputs[i].nextSibling.innerHTML;

Points of Interest

There is no need to write code in ASP.NET checkbox list control.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Team Leader
India India
I am working in Microsoft technology since 2001. Love to write code in JavaScript, and Ajax. See my site at

You may also be interested in...

Comments and Discussions

Questionposback Pin
raman lasara21-Aug-14 4:39
memberraman lasara21-Aug-14 4:39 
GeneralMy vote of 1 Pin
Arun Patjosy9-Dec-12 20:10
memberArun Patjosy9-Dec-12 20:10 
GeneralOnce it checked; it does not uncheck Pin
MKakkar26-Aug-10 20:07
memberMKakkar26-Aug-10 20:07 
GeneralOn click image event Pin
spoodygoon5-Feb-09 8:11
memberspoodygoon5-Feb-09 8:11 
QuestionWhat if nextSibling==null? Pin
Simon Capewell2-Jul-08 3:29
memberSimon Capewell2-Jul-08 3:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170525.1 | Last Updated 5 Feb 2009
Article Copyright 2008 by Ravinder007
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid