Numeric Textbox Disabled

3 posts, 0 answers
  1. Charles
    Charles avatar
    2 posts
    Member since:
    Mar 2009

    Posted 20 May 2010 Link to this post

    Probably a stupid newbie question, but here goes.  I have a Panel Bar with 2 Panel Items.  Very simple controls.  Panel Item [0] has a radtextbox.  Panel Item [1] has a numeric textbox.

    When I load the page, I disable the Panel Item [1].  I expand and select Panel [0].
    When the page posts back, I Enable, Select, and Expand Panel Item [1]. 

    Problem:  the numeric textbox is in Panel [1] is disabled after postback
    Puzzle:  I added a Date Picker control to Panel [1].  It is not disabled after postback.

    This seems like arbitrary behavior to me.  Anyone have an answer?




  2. Charles
    Charles avatar
    2 posts
    Member since:
    Mar 2009

    Posted 20 May 2010 Link to this post

    As an addendum, if I add Code-Behind to Enable the numeric textbox in the postback event, the textbox is enabled as expected.
    Also, the standard radtextbox acts the same way.

    It seems like if I don't specifically disable the control it should stay enabled, and disable its container should have no direct effect on it. 
    At the very least, if disabling the container disables the enclosed control, shouldn't enabling the container enable the enclosed control?


  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 25 May 2010 Link to this post

    Hi Charles,

    I just identified the source of your problem, but I am pretty sure you will see this behavior (the control is disabled after client-side set_enabled(true) over its parent) for any control that is in this item template. This means that the datePicker should get this behavior too.

    Anyway, this is happening because you try to enable the item from the client. I would like to suggest a solution:
    - Enable the item server-side.
    That way with only one line of code you are going to enable all of its child-controls.

    If you do want to stick with the client-side - then you have to enable every control in the entire collection of child controls one-by-one (I would say that it doesn't worth it and it's a way better and cleaner solution to just set the item's Enabled property to true server-side). Also you will have to know the ID's of the elements which you want to enable. This should look like the following:
    ...
    // This only works if the control in the template has js object representing it
    panel.get_items().getItem(indexOfEnabledItem).findControl("id of child control").set_enabled(true);
    ...


    Hope this is going to help you!


    Regards,
    Nikolay Tsenkov
    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.
Back to Top