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

RadNumericTextBox visibility strange behaviour

4 Answers 217 Views
Input
This is a migrated thread and some comments may be shown as answers.
Sonia
Top achievements
Rank 1
Sonia asked on 17 Oct 2014, 06:52 AM
I want to hide a RadNumericTextBox and later make it visible by javascript:

tbNumPeriodos.set_visible(show);

However, it does not work fine when after hiding RadNumericTextBox in code behind

I have tried several options in code behind:

tbNumPeriodos.Style.Add("display", "none");
If I set visibility to true by javascript, only down arrow is shown and the place when the textbox is not shown.

tbNumPeriodos.Style.Add("visibility", "hidden");     
If I set visibility to true by javascript, up & down arrows are shown and the place when the textbox should appear is reservated but it is not shown.

Any idea on how to achieve that?

4 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 21 Oct 2014, 12:53 PM
Hi,

Check out the following code snippets that illustrate how you can hide and show a RadNumericTextBox control. Note that client-side logic is used to toggle the visibility of the control.

Sample Markup:

<asp:Button Text="Toggle TextBox visibility" runat="server" ID="ButtonToggle" OnClientClick="toggleTextBoxVisible(this, event); return false;" />
 
<telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" ></telerik:RadNumericTextBox>

JavaScript:

function toggleTextBoxVisible(sender, args) {
    var numericTextBox = $find("<%= RadNumericTextBox1.ClientID %>");
    numericTextBox.set_visible(!numericTextBox.get_visible());
}

Let me know how the approach works for you.

Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Sonia
Top achievements
Rank 1
answered on 22 Oct 2014, 05:44 AM
Hi Viktor,

thank you for your response although it does not answer my question, I know how to change visibility of RadNumericTextBox by in client side.
The problem happens when I hide it in code behind on page load and later i want to change its visibility. Then the RadNumericTextBox does not render well.
0
Accepted
Viktor Tachev
Telerik team
answered on 24 Oct 2014, 01:35 PM
Hi Sonia,

If you would like to set the RadNumericTextBox as invisible on the server you can use the Display property. This way the whole control will be initially hidden. It will also be rendered correctly on the page and you will be able to use JavaScript to show it.

Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Sonia
Top achievements
Rank 1
answered on 27 Oct 2014, 08:15 AM
Thank you Viktor,
this was exactly what i was looking for.
Tags
Input
Asked by
Sonia
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Sonia
Top achievements
Rank 1
Share this question
or