Show hidden radtextbox in javascript and server sided

6 posts, 0 answers
  1. Laura
    Laura avatar
    131 posts
    Member since:
    Aug 2008

    Posted 06 Jan 2009 Link to this post

    I have the following radtextbox that is set in the aspx so it is hidden on page load.

    <b>&lt;telerik:RadTextBox ID="pName" runat="server" style="display:none" &gt;&lt;/telerik:RadTextBox&gt;</b> 


    I am trying to show it on different events, one of which is on rowclick of a radgrid. I have this in my javascript code and it is not working ( i tried setting it to "" to "block" and to "inline" and it never shows.

     
    document.getElementById('pName').style.display = ''


    I also try setting it in C#:

    pName.Style.Add("display""block"); 
     

    And nothing I do makes it appear on the page.


  2. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 07 Jan 2009 Link to this post

    Hi Laura,

    RadTextBox has more complex HTML rendering than regular asp:TextBoxes and CSS styles are apllied in a different way.

    Here is an example with two alternative Javascript functions, which work:

    HTML

    <asp:Button ID="Button1" runat="server" Text="Toggle RadTextBox" OnClientClick="ToggleRadTextBox();return false;" /> 
     
    <telerik:RadTextBox ID="RadTextBox1" runat="server" style="display:none" Text="RadTextBox1" /> 

    Javascript

    function ToggleRadTextBox() 
        var tb = $find("<%= RadTextBox1.ClientID %>")._textBoxElement; 
        tb.style.display = tb.style.display == "none" ? "" : "none"

    Alternative Javascript

    function ToggleRadTextBox() 
        var tb = $get("<%= RadTextBox1.ClientID %>_text"); 
        tb.style.display = tb.style.display == "none" ? "" : "none"


    Kind regards,
    Dimo
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. mzn developer
    mzn developer avatar
    68 posts
    Member since:
    Jul 2005

    Posted 30 Jan 2009 Link to this post

    This works to show the hidden textbox initially, but when I mouse over the textbox it disappears.  Any ideas?
  5. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 02 Feb 2009 Link to this post

    Hello,

    You are right, I didn't think about this. Please refer to this forum thread, which discusses the same issue:

    http://www.telerik.com/community/forums/aspnet-ajax/input/style-of-dateinput-on-the-client.aspx

    Kind regards,
    Dimo
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Vijay kumar
    Vijay kumar avatar
    3 posts
    Member since:
    Nov 2012

    Posted 06 Nov 2012 Link to this post

    I am also facing what mzn developer  have..i followed below link what did u post on page.that didnt work for me...
    please send solutions that would be great....
  7. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Nov 2012 Link to this post

    Hi,

    One suggestion is that you can set the visibility of RadTextBox as follows.

    C#:
    protected void Button1_Click(object sender, EventArgs e)
    {
      RadTextBox1.Visible = (RadTextBox1.Visible == false) ? true : false;
    }

    Hope this helps.

    Thanks,
    Princy.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017