RadNumericTextBox visibility strange behaviour

5 posts, 1 answers
  1. Sonia
    Sonia avatar
    90 posts
    Member since:
    Mar 2012

    Posted 17 Oct 2014 Link to this post

    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?

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 21 Oct 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sonia
    Sonia avatar
    90 posts
    Member since:
    Mar 2012

    Posted 22 Oct 2014 in reply to Viktor Tachev Link to this post

    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.
  5. Answer
    Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 24 Oct 2014 Link to this post

    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.

     
  6. Sonia
    Sonia avatar
    90 posts
    Member since:
    Mar 2012

    Posted 27 Oct 2014 in reply to Viktor Tachev Link to this post

    Thank you Viktor,
    this was exactly what i was looking for.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017