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

Show hidden radtextbox in javascript and server sided

6 Answers 573 Views
Input
This is a migrated thread and some comments may be shown as answers.
Laura
Top achievements
Rank 1
Laura asked on 06 Jan 2009, 07:03 PM
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.


6 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 07 Jan 2009, 08:51 AM
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.
0
mzn developer
Top achievements
Rank 1
answered on 30 Jan 2009, 05:38 PM
This works to show the hidden textbox initially, but when I mouse over the textbox it disappears.  Any ideas?
0
Dimo
Telerik team
answered on 02 Feb 2009, 03:24 PM
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.
0
Vijay kumar
Top achievements
Rank 1
answered on 06 Nov 2012, 01:39 PM
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....
0
Princy
Top achievements
Rank 2
answered on 07 Nov 2012, 07:25 AM
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.
0
Matt
Top achievements
Rank 1
answered on 16 May 2018, 08:48 PM
Works perfect.  Thanks!
Tags
Input
Asked by
Laura
Top achievements
Rank 1
Answers by
Dimo
Telerik team
mzn developer
Top achievements
Rank 1
Vijay kumar
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Matt
Top achievements
Rank 1
Share this question
or