akiaz Posted May 5, 2005 Posted May 5, 2005 How can you lock a radiobutton so that it shows the value, either checked or not checked (not really a check but a dot), but is not greyed out like when you set the enabled property to false? Is there some css style that I can apply so that it keeps it's original look? I know that I could not show the radiobutton and show a graphic image in it's place but that seems more like a hack than a good solution. The reason for this is so that I can show a form in "readonly" mode but not allow the user to change anything. Quote
akiaz Posted May 5, 2005 Author Posted May 5, 2005 I have sort of come up with a solution myself... I check to see if my page should be in readonly mode, and if so then all radiobuttons that are grouped together get their groupname changed to a unique name. Also, any radio button that should not be selected, I add some javascript code which prevents selection of the radiobutton. I have tested this using both mouse and keyboard and it seems to work fine so far. if (isReadOnlyMode) { this.amiYes.GroupName = "AMIYesOnly"; this.amiNo.GroupName = "AMINoOnly"; if (diagnosisAMI) { this.amiYes.Checked = true; this.amiNo.Checked = false; this.amiNo.Attributes.Add("onclick", "return false;"); } else { this.amiYes.Checked = false; this.amiNo.Checked = true; this.amiYes.Attributes.Add("onclick", "return false;"); } } else { this.amiYes.Checked = diagnosisAMI; this.amiNo.Checked = !diagnosisAMI; } Seems like a lotta code though just to achieve some simple functionality. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.