CheckBoxList Readonly

X

Xarky

Hi,
I have a checkboxlist and would like to set it as readonly. The
properties that I found for it is the Enabled(true, false). Now when
I am setting it to false, it is becoming as readonly, but is changing
its appearance and does not seems to be so presentable (color becoming
greyish, text and check boxes are not clear). I tried to change the
fore-color, but in disabled state, it has no effect.

Can someone tell me how I can get round this problem.
Thanks in Advance
 
K

karthick

Yes, you are right. It is not possible make the checkbox Read Only. The
only way to achive what you want is to programmatically allow or not
allow the user to check the checkbox accordingly.

Hth,
Karthick
 
B

billmiami2

You can also create a user control using two images for checkboxes--one
as checked and the other as not checked. The control would have a
property called Checked which would be boolean, and a function to set
the image as below:

Public Class cbox
Inherits System.Web.UI.UserControl
Protected WithEvents img1 As HtmlImage

Private blChecked As Boolean

Public Property Checked() As Boolean
Get
Checked = blChecked
End Get
Set(ByVal Value As Boolean)
blChecked = Value
SetImage()
End Set
End Property

Function SetImage()
If blChecked Then
img1.Src = "../images/c_box_on.gif"
Else
img1.Src = "../images/c_box_off.gif"
End If
End Function

I use this control everywhere I need a read-only checkbox.

Bill E.
Hollywood, FL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,813
Messages
2,569,696
Members
45,483
Latest member
TedDvb6626

Latest Threads

Top