Does Enabled = False cause Children.Enabled = False?

5 posts, 1 answers
  1. Ioannis
    Ioannis avatar
    35 posts
    Member since:
    Dec 2018

    Posted 10 Feb 2019 Link to this post

    Hello,

    So, I have a SplitContainer which contains checkboxes and stuff whose Enabled and Checked statuses will determine what Values will be written on the Database.
    When the process to write to the DB begins, I make the Splitcontainer.Enabled = False so that the user will not change anything after the Submit button has already been pressed.
    I notice that even though the togglebutton's enabled status is True, when its parent, the Splitcontainer has Enabled=False, the togglebutton itself goes to Enabled=False.
    I didn't programme such behaviour, so am I right to assume that this is something that happens by default on Telerik controls?

     

    If so, is there a way to globally disable it? On the normal Windows Forms Controls this doesn't exist and I am used to leveraging this behaviour.

  2. Dimitar
    Admin
    Dimitar avatar
    2907 posts

    Posted 11 Feb 2019 Link to this post

    Hi Ioannis,

    This functionality is inherited from the standard .NET controls and I believe that it should work this way. I am not sure how this prevents you from executing your code. You can get the value even if the control is disabled. If you can provide a more detailed description perhaps I can suggest another solution.

    I am looking forward to your reply.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Ioannis
    Ioannis avatar
    35 posts
    Member since:
    Dec 2018

    Posted 11 Feb 2019 in reply to Dimitar Link to this post

    You can get the value, but the value will always be FALSE even if when it's actually TRUE.
    Unfortunately I can't make a reproducible example at the moment but I'll give an example for the time being and on the evening or tomorrow I can give a reprex.

    I have a SplitContainer named SC1 and a togglebutton named tgl1
    If I do:
    tgl1.Enabled = TRUE
    SC1.Enabled = FALSE
    then tgl1.Enabled will be FALSE even though it was set to TRUE before.

    However, upon doing SC1.Enabled = TRUE, magically tgl1.Enabled is TRUE again.

    Is this behaviour expected?
    Or is it something that only I am experiencing? (Is so... perhaps I've been changing the tgl1.Enabled value to false without realising it?)
  4. Answer
    Dimitar
    Admin
    Dimitar avatar
    2907 posts

    Posted 12 Feb 2019 Link to this post

    Hello Ioannis,

    Setting the Enabled property of the split container will disable the controls inside it, the Enabled property of the child controls will return the current state but it would not affect the locally set value. In other words, the previous local value will be restored. I have attached a small video that illustrates this.

    I hope this will be useful. Let me know if you have additional questions.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Ioannis
    Ioannis avatar
    35 posts
    Member since:
    Dec 2018

    Posted 12 Feb 2019 in reply to Dimitar Link to this post

    I see, thank you :)
Back to Top