Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making text box hidden in ASP.NET

Tags:

html

c#

asp.net

I am using ASP.NET 3.5 and C#.

On my page I need to have a Text box that must not be visible to the user but it MUST be there when you look at the Page Source, reason being, another program called Eloqua will be looking at the page source and it must get the value of that text box.

The value of that text box will be populated based on what the user selects.

Thus, I cant set the text box property to Visible = False because then it will not be in the source HTML and I can't set the Enabled = False because I do not want the user to see the text box.

Is there some property I can use to make this text box hidden to the user but still visible in the page source?

My ASP.NET text box

<asp:TextBox ID="txtTester" runat="server"></asp:TextBox>
like image 540
Etienne Avatar asked Nov 27 '09 08:11

Etienne


People also ask

How to hide the text box in asp net?

The Visible=false property will preserve the space for a specifc control while style="display:none" will hide the textbox and doesnt preserve the space.

How to hide a field in asp net?

Right click on project and select Add-->Add New Item and select Web Form. Add a new Web Form called "Default. aspx". Now, drag and drop the HiddenField Control on the page.

What property hides a textbox in the screen?

The visibility property allows the author to show or hide an element.

What is hidden field in asp net?

Hidden fields are a common trick of the HTML web developer's trade for carrying information within a page when you do not want that information to be visible to the user—that is, the hidden field provides a way to store state information in the page.


1 Answers

You can use a hidden field.

<asp:HiddenField id="myHiddenInput" runat="server" />

Use it just like a textbox.

like image 132
Quintin Robinson Avatar answered Sep 22 '22 19:09

Quintin Robinson