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

Numeric Textbox Disabled

2 Answers 102 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 20 May 2010, 06:26 PM
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 Answers, 1 is accepted

Sort by
0
Charles
Top achievements
Rank 1
answered on 20 May 2010, 06:36 PM
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?


0
Nikolay Tsenkov
Telerik team
answered on 25 May 2010, 05:42 PM
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.
Tags
PanelBar
Asked by
Charles
Top achievements
Rank 1
Answers by
Charles
Top achievements
Rank 1
Nikolay Tsenkov
Telerik team
Share this question
or