This is a migrated thread and some comments may be shown as answers.

RadListBox still allows interaction when disabled.

6 Answers 144 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 17 Aug 2010, 07:41 AM
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:
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.

6 Answers, 1 is accepted

Sort by
0
Jason
Top achievements
Rank 1
answered on 17 Aug 2010, 07:54 AM
Never Mind. I've solved the problem.

I just had to disable/enable all the RadListBoxItems too.

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;
                foreach (RadListBoxItem item in ((RadListBox)cntrl).Items)
                {
                    item.Enabled = setEdit;
                }
                break;
            default:
                break;
        }
        //Call for additional controls:
        if (cntrl.HasControls())
            DisablePageControls(cntrl, setEdit);
    }
}
0
Stuart Hemming
Top achievements
Rank 2
answered on 17 Aug 2010, 05:11 PM
Lourein,

You should consider this a workaround at best. It is, IMO perfectly sensible to expect the ListItems to be disabled if you disable the ListBox.

I would post this as a bug in the PITS with a view to getting it fixed.

-- 
Stuart
0
Genady Sergeev
Telerik team
answered on 20 Aug 2010, 08:31 AM
Hi Lourein,

This is indeed bug with RadListBox when server-side transfer is used. I've logged it into our bug tracking system and we will try to get it resolved as soon as possible. I've also updated your telerik points as a token of gratitude for the report.

Kind regards,
Genady Sergeev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stuart Hemming
Top achievements
Rank 2
answered on 20 Aug 2010, 08:34 AM
Genady,

I'm guessing this is too late to make it in to the up-coming SP?

-- 
Stuart
0
Simon
Telerik team
answered on 23 Aug 2010, 10:18 AM
Hi Stuart Hemming,

Unfortunately yes. We could not manage to include this in the SP in favor of more important bugfixes. Still we will surely address it after the SP is out.

All the best,
Simon
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stuart Hemming
Top achievements
Rank 2
answered on 23 Aug 2010, 10:19 AM
Simon,

Thanks for the update.

-- 
Stuart
Tags
ListBox
Asked by
Jason
Top achievements
Rank 1
Answers by
Jason
Top achievements
Rank 1
Stuart Hemming
Top achievements
Rank 2
Genady Sergeev
Telerik team
Simon
Telerik team
Share this question
or