Hi,
I have an edit form that has previously contained an asp CheckBoxList. I want to change it to use a RadListBox as I have done throughout the rest of the site to make apply styles consistently using AppTheme skinning.
But this edit form initially disables all controls until the user clicks an edit button which enables them. It works with all other RadControls I have in the form (RadComboBox, RadTreeView, RadMaskedTextBox and RadToolTip) but unfortunately when applied in the same way to the RadListBox the client can still check checkboxes and/or select items in the RadListBox.
The function used to disable/enable the controls is as follows:
I would also prefer the checkboxes/items to be "greyed out" or similar as is the case when the asp CheckBoxList is disabled.
Is this at all possible?
Cheers.
I have an edit form that has previously contained an asp CheckBoxList. I want to change it to use a RadListBox as I have done throughout the rest of the site to make apply styles consistently using AppTheme skinning.
But this edit form initially disables all controls until the user clicks an edit button which enables them. It works with all other RadControls I have in the form (RadComboBox, RadTreeView, RadMaskedTextBox and RadToolTip) but unfortunately when applied in the same way to the RadListBox the client can still check checkboxes and/or select items in the RadListBox.
The function used to disable/enable the controls is as follows:
private
static
void
DisablePageControls(Control myControl, Boolean setEdit)
{
foreach
(Control cntrl
in
myControl.Controls)
{
switch
(cntrl.GetType().ToString())
{
case
"System.Web.UI.WebControls.TextBox"
:
((TextBox)cntrl).Enabled = setEdit;
break
;
case
"Telerik.Web.UI.RadTreeView"
:
((RadTreeView)cntrl).Enabled = setEdit;
break
;
case
"Telerik.Web.UI.RadMaskedTextBox"
:
((RadMaskedTextBox)cntrl).Enabled = setEdit;
break
;
case
"Telerik.Web.UI.RadToolTip"
:
((RadToolTip)cntrl).Enabled = setEdit;
break
;
case
"Telerik.Web.UI.RadDatePicker"
:
((RadDatePicker)cntrl).Enabled = setEdit;
break
;
case
"System.Web.UI.WebControls.DropDownList"
:
((DropDownList)cntrl).Enabled = setEdit;
break
;
case
"System.Web.UI.WebControls.CheckBox"
:
((CheckBox)cntrl).Enabled = setEdit;
break
;
case
"System.Web.UI.WebControls.LinkButton"
:
((LinkButton)cntrl).Enabled = setEdit;
break
;
case
"System.Web.UI.WebControls.CheckBoxList"
:
((CheckBoxList)cntrl).Enabled = setEdit;
break
;
case
"Telerik.Web.UI.RadComboBox"
:
((RadComboBox)cntrl).Enabled = setEdit;
break
;
case
"Telerik.Web.UI.RadListBox"
:
((RadListBox)cntrl).Enabled = setEdit;
break
;
default
:
break
;
}
//Call for additional controls:
if
(cntrl.HasControls())
DisablePageControls(cntrl, setEdit);
}
}
I would also prefer the checkboxes/items to be "greyed out" or similar as is the case when the asp CheckBoxList is disabled.
Is this at all possible?
Cheers.