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>
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.
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.
The visibility property allows the author to show or hide an element.
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.
You can use a hidden field.
<asp:HiddenField id="myHiddenInput" runat="server" />
Use it just like a textbox.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With