Complete hide textbox without loosing functionality

<asp:TextBox ID="txtHiddenTeamBalances" runat="server" Width="0px" BackColor="Transparent" ForeColor="White" BorderStyle="None" ReadOnly="true"></asp:TextBox>

Published Monday, June 30, 2008 12:49 PM by kemaltolga
Filed under:

Comments

# re: Complete hide textbox without loosing functionality

Monday, June 30, 2008 12:57 PM by dukebaby

When is this useful?

# re: Complete hide textbox without loosing functionality

Monday, June 30, 2008 2:30 PM by markvt

It's not hidden it's still on the page and someone could select it when clicking init.

Why not use a session variable?

# re: Complete hide textbox without loosing functionality

Monday, June 30, 2008 4:16 PM by Mark Hildreth

Alternatively, you can just add the attribute Visible="false". That has has the added benfit that if would prevent someone from just viewing the page source and discovering the textbox value.

# re: Complete hide textbox without loosing functionality

Wednesday, July 02, 2008 9:18 AM by Jason Clark

Actually, instead of Visible="False" (which doesn't render the control in the DOM), you could just do style="display:none;" which hides the control on the page, but still renders it on the DOM, and allows you to do anything with it you desire.

It also reduces the amount of code you have to write to do the exact same thing.

# re: Complete hide textbox without loosing functionality

Monday, August 16, 2010 8:46 AM by Grei

Jason Clark's solution did it for me!

I was generating controls dynamically and in some case I needed to hide it from user:

txt.Attributes.Add("style", "display:none;");

# re: Complete hide textbox without loosing functionality

Wednesday, August 25, 2010 4:22 AM by Maya

its a  not a transparent idea. textbox is unhidden

# re: Complete hide textbox without loosing functionality

Friday, April 15, 2011 1:16 PM by Isaac

That's nice to me! Gracias!

# re: Complete hide textbox without loosing functionality

Tuesday, May 17, 2011 6:39 AM by Rizwan

Great, solve my problem

Leave a Comment

(required) 
(required) 
(optional)
(required)