RadListBox still allows interaction when disabled.

7 posts, 0 answers
  1. Jason
    Jason avatar
    26 posts
    Member since:
    Nov 2006

    Posted 17 Aug 2010 Link to this post

    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.
  2. Jason
    Jason avatar
    26 posts
    Member since:
    Nov 2006

    Posted 17 Aug 2010 Link to this post

    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);
        }
    }
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 17 Aug 2010 Link to this post

    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
  5. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 20 Aug 2010 Link to this post

    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
  6. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 20 Aug 2010 Link to this post

    Genady,

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

    -- 
    Stuart
  7. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 23 Aug 2010 Link to this post

    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
  8. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 23 Aug 2010 Link to this post

    Simon,

    Thanks for the update.

    -- 
    Stuart
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017