Making a CheckBoxList Read Only Without Greying it

Today I was attempting to create a Check Box list in asp.net to show the status of the files uploaded to the server. The Check Box should remain checked if the file is already in the server and unchecked if not present in the database.

Initially I tried the,

 CheckBoxList.Enabled = true;

which serve my purpose but it greys out the Check Box list  making the text hard to read. Also I found that CheckBoxList doesn’t have a Read Only Property. Finally after a lot of Googling I found out a solution for this so that the CheckBoxList cannot be unchecked or checked by the user and also is not grayed out.

Use the following Line to obtain the above mentioned feature.

CheckBoxList1.Attributes.Add(“onclick”, “return false;”);

Hope this Helps,

Kiran