473,396 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to prevent changes to CheckBoxList

Hello.
Can anyone tell me if there is ANY way to prevent the user changing
the values in a checkboxlist. I just want to use it for information
only. Disabling it is not an option as it results in a unacceptable
gray color.

Many thanks in advance for any replies.
Nov 17 '05 #1
4 2413
Use a bit of javascript in the onChanged property, and set it back to it's
checked property every time.

D

<Meerkat> wrote in message
news:k7********************************@4ax.com...
Hello.
Can anyone tell me if there is ANY way to prevent the user changing
the values in a checkboxlist. I just want to use it for information
only. Disabling it is not an option as it results in a unacceptable
gray color.

Many thanks in advance for any replies.

Nov 17 '05 #2
Hello Rajesh,

Your suggestion looks to be just the sort of thing I am looking for.
( i.e. simple) However, could I impose on your kindness a little
more and ask exactly where do I put the code that you suggest.
Is it in the code behind or the html? and what is the exact syntax.
I have tried all sorts of things but failed miserably.

Many thanks in anticipation,

Meerkat.
On Wed, 02 Jul 2003 04:58:17 -0700, Rajesh Tiwari <ra****@dospl.com>
wrote:
use onfocus="this.blur()"

try something like
ChkBoxId.Attributes("onfocus")="javascript:this.b lur()"

hope it helps

Rajesh

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 17 '05 #3
hi meerkat,
sorry for the late reply.here is the code that u were looking for.

run this code and see if it is of some help

<%@ Page Language="c#" debug=true%>
<%@ Import Namespace="System.Data" %>
<Script Language="C#" runat=server>
void Page_Load(Object sender,EventArgs e)
{

lst2.Attributes["onclick"]="javascript:return false";
}
</script>
<html>
<body>
<form id=frm1 runat=server>
<asp:CheckBoxList id=lst2 runat=server>
<asp:ListItem>a</asp:Listitem>
</asp:CheckBoxList>
</form>
</body>
</html>

i hope i answered ur query.

Rajesh

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #4
how about setting ENABLED property to false
or VISIBLE property to false
"Rajesh Tiwari" <ra****@dospl.com> wrote in message
news:eJ**************@TK2MSFTNGP10.phx.gbl...
hi meerkat,
sorry for the late reply.here is the code that u were looking for.

run this code and see if it is of some help

<%@ Page Language="c#" debug=true%>
<%@ Import Namespace="System.Data" %>
<Script Language="C#" runat=server>
void Page_Load(Object sender,EventArgs e)
{

lst2.Attributes["onclick"]="javascript:return false";
}
</script>
<html>
<body>
<form id=frm1 runat=server>
<asp:CheckBoxList id=lst2 runat=server>
<asp:ListItem>a</asp:Listitem>
</asp:CheckBoxList>
</form>
</body>
</html>

i hope i answered ur query.

Rajesh

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bryce Budd | last post by:
Hello All, I've been a taker of information from newsgroups for a long time and thought I'd finally make a contribution back to the community whose supported me when I've needed it. After all...
4
by: dm_dal | last post by:
Is there a know issue surrounding the CheckBoxList control and it's viewstate? When my control is created, it's ListItems are checked as needed, but on a postback, they loose their Selected...
4
by: Shaul Feldman | last post by:
Hello, I have something really awkward at work - fighting with CheckBoxList... How can I define CSS for ListItem in CheckBoxList programmatically. I add CheckBoxList's Items on the fly, something...
2
by: MattB | last post by:
Hi I have a form with a CheckBoxList that gets bound at runtime. I split it into columns if there are a lot of items, but the formatting of those columns isn't what I was looking for. Specifically,...
5
by: Eirik Eldorsen | last post by:
I'm trying to code a reapter that for each listelement show a checkboxlist. I'm almost there. The only thing I can't figure out is how to set the ID of the checkboxlists. This is my code:...
3
by: I am Sam | last post by:
I keep getting the following error message when I try to iterate through a CheckBoxList control: Object reference not set to an instance of an object. Description: An unhandled exception...
5
by: Patrick.O.Ige | last post by:
I'm binding a CheckBoxlist below in the ItemDataBound(the CheckBoxList is in a Datalist) By doing "li.Selected = True" i can see all the checkBoxes are selected. But what i want is to be able...
4
by: Patrick.O.Ige | last post by:
I have a CheckBoxList in a DataList and i'm trying to get item Selected after doing a postBack. I have set my CheckBoxlist AutoPostBack="True" Any ideas what 'm doing wrong? It seems not to...
2
by: Patrick.O.Ige | last post by:
I have some boolean value(1 or 0 ) in a table and i want a databinded CheckBoxList to present the selected values on the page.. With CheckBox i know i can se the Checked property like so :-...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.