Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Hidden Textbox

Reply
Thread Tools

Hidden Textbox

 
 
Rob T
Guest
Posts: n/a
 
      06-10-2004
I have a user control that need to have a hidden textbox. (I have some JS
that needs to get some info out of it) If I make a standard textbox
(<asp:TextBox ID="txtTest" Runat="server" />) in my control it works
fine....of course it shows it on the screen

It seems so simple...but how the heck do you create a hidden textbox that is
a control?

BTW, I've done hidden textboxes in the past my just doing a
response.write("<input type=hidden ...>") before, but now since I will have
several of the same controls on the page, I need to keep track of the ID of
the box. I figured using a control is nice since it remembers the values it
has on a postback.......

Thanks.

-Rob T.



 
Reply With Quote
 
 
 
 
Jos
Guest
Posts: n/a
 
      06-11-2004

"Rob T" <(E-Mail Removed)> wrote in message
news:%23we$(E-Mail Removed)...
> I have a user control that need to have a hidden textbox. (I have some JS
> that needs to get some info out of it) If I make a standard textbox
> (<asp:TextBox ID="txtTest" Runat="server" />) in my control it works
> fine....of course it shows it on the screen
>
> It seems so simple...but how the heck do you create a hidden textbox that

is
> a control?
>
> BTW, I've done hidden textboxes in the past my just doing a
> response.write("<input type=hidden ...>") before, but now since I will

have
> several of the same controls on the page, I need to keep track of the ID

of
> the box. I figured using a control is nice since it remembers the values

it
> has on a postback.......


There is a hidden HTML server control in ASP.NET:

<input type="hidden" runat="server" id="hidden1" value="whateverValue">

From code, you can get and set its value:
hidden1.value = "test"

Jos


 
Reply With Quote
 
 
 
 
Shawn B.
Guest
Posts: n/a
 
      06-11-2004
In addition, I've also created one on www.planet-source-code.com that
"ghosts" to indicate it is a hidden field among all the other textboxes. I
also created that before I knew you can right-click an html control and
choose "run at server" but I still use the custom control because on some
screens (mainly the search screens for our application) we may have 30 text
boxes and I like to see immediately which ones are hidden and which ones
aren't. Search for "Shawn Bullock" on PSC under the.NET section if you're
interested. Source code in C# and VB.NET.


Thanks,
Shawn


"Jos" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
> "Rob T" <(E-Mail Removed)> wrote in message
> news:%23we$(E-Mail Removed)...
> > I have a user control that need to have a hidden textbox. (I have some

JS
> > that needs to get some info out of it) If I make a standard textbox
> > (<asp:TextBox ID="txtTest" Runat="server" />) in my control it works
> > fine....of course it shows it on the screen
> >
> > It seems so simple...but how the heck do you create a hidden textbox

that
> is
> > a control?
> >
> > BTW, I've done hidden textboxes in the past my just doing a
> > response.write("<input type=hidden ...>") before, but now since I will

> have
> > several of the same controls on the page, I need to keep track of the ID

> of
> > the box. I figured using a control is nice since it remembers the

values
> it
> > has on a postback.......

>
> There is a hidden HTML server control in ASP.NET:
>
> <input type="hidden" runat="server" id="hidden1" value="whateverValue">
>
> From code, you can get and set its value:
> hidden1.value = "test"
>
> Jos
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate Hidden field on post back and retrieve value from Hidden Field Rick ASP .Net 3 04-13-2010 05:38 PM
Win 7 folders hidden despite 'show hidden' checked Boppy NZ Computing 10 01-23-2010 02:56 AM
How would I discover the text in a block element hidden by overflow:hidden style being set? SolarCanine Javascript 2 09-20-2005 06:27 PM
Hidden Textbox Brent Burkart ASP .Net 1 04-26-2005 10:11 PM
Hidden textbox values lost!! Rajesh ASP .Net 3 09-10-2003 02:39 PM



Advertisments