Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 892
  • Last Modified:

readonly property for checkbox in asp.net

is there a way to make the checkbox readonly. enabled property will work for me but i don't want the ckechbox to be grayed out. i have seen there is a readonly property for textbox object but not for checkbox which does what i want.

Thanks,
AJ.
0
avisjk
Asked:
avisjk
  • 2
  • 2
1 Solution
 
iboutchkineCommented:
Create image with checkbox and show or hide it
0
 
CarlosMuCommented:
You can also put code on the check event.  I presume that you dont want to always have the checkbox disable but want sometimes to allow the user to change the content and sometimes to prevent it.  If so you will need some kind of bolean variable to indicate that change is not allowed.  On the check event check that boolean if it is on then just change the value back.  To the user it will look just as if the check box never changed.
0
 
avisjkAuthor Commented:
Carlos,

i thought about it, but to do this i will have to set the checkbox's autopost to true and this will cause a roundtrip to server, so i wanted to avoid that.

Thanks,
AJ.
0
 
CarlosMuCommented:
Not if the code is Javascript runing on the client,  Attached to the click event of the checkbox
0
 
avisjkAuthor Commented:
i am trying to do make it work even on browsers where javascript is disabled. thats the reason i am doing all my validation on the server side.

Thanks,
AJ
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now