Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 5th, 2006, 10:47 PM
Authorized User
 
Join Date: Dec 2005
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default Changing textboxes to hidden fields - HELP!!!

Hi,

I need to change an existing text box to a hidden field. Please help!!!

<asp:textbox id="txtUser" runat="server" Width="134px"></asp:textbox>

I added value="theUsersName" and it populated the box...now I just need to make it hidden. I tried adding type="hidden" but that didn't work. Any help is truly appreciated!
 
Old February 5th, 2006, 11:18 PM
Friend of Wrox
 
Join Date: Feb 2006
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to gaurav_jain2403
Default

Type = "hidden" will not work here as this is not the HTML control. Use this property:

textbox.visible = "false"

Gaurav
 
Old February 5th, 2006, 11:21 PM
Authorized User
 
Join Date: Dec 2005
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Do I put that inside the <asp:.....> tag?


 
Old February 5th, 2006, 11:55 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You can put it in the tag, but if you want to do it programatically you need to do it in the code behind wiht:
textbox.visible = false

 
Old February 10th, 2006, 07:46 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

If you actually want to make it a hidden form field (versus an invisible text box) you need to use the actual hidden form element. You can still have access to it from the code behind as a System.Web.UI.HtmlControl.HtmlInputHidden:

<input type="hidden" runat="server" id="hidUserName" />

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating Dates and Changing two other fields arholly Access VBA 11 December 7th, 2006 01:31 PM
hidden input fields and Mozilla panos CSS Cascading Style Sheets 1 February 3rd, 2006 05:45 PM
Creating hidden fields SmoothAl BOOK: Beginning ASP 3.0 0 February 6th, 2005 01:44 AM
empty fields not hidden anymore (php/mySQL) jasmin Beginning PHP 1 January 17th, 2005 12:42 PM
CH3, pg 96 Hidden Form Fields wadesmart BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 19 October 28th, 2003 03:18 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.