I am sure that this can be improved upon, but here is something that works.
To test the code out (listed below), simply add a CheckBoxList control to a
web form (name = "clb") and add the code below to the Page_Load event. When
you run the form, there will be 4 items which start out as unchecked. When
you click on an item, it will become checked and you will not be able to
uncheck it. This should give you a base to work from.
HTH,
Jody
__________________
Dim x() As String = {1, 2, 3, 4}
Dim intCount As Integer
Dim strItemName As String
Dim strScript As String
clb.DataSource = x
clb.DataBind()
For intCount = 0 To x.Length - 1
strItemName = clb.ClientID & "_" & intCount.ToString
strScript = "<script language = jscript for =" & strItemName & " event
=""onclick"">" & ControlChars.CrLf
strScript &= strItemName & ".checked='true';" & ControlChars.CrLf
strScript &= " </script> " & ControlChars.CrLf
RegisterClientScriptBlock("script" & intCount.ToString, strScript)
Next
___________________
"sql" <do*******@nospaml.com> wrote in message
news:eh**************@TK2MSFTNGP09.phx.gbl...
Hi all,
I am using a CheckBoxList control on my aspx page that I bind to an
array at runtime. After I databind it, I check two of the items in the
CheckBoxList controls. Now I also need to disable these two items so that
users can't uncheck them. But I don't know how to disable individual
items. Can you please help me achieving this(preferably at runtime)?
Thanks in advance.