Search:
Namespaces
Discussions
.NET v1.1
Feedback
passing hidden values
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngbeta' list
.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Josh Soffe
-- This message, which was originally sent to "aspngcommunity", has been moved to "aspngbeta" mailing list by the List Master --
I have created a form in which I pass hidden values through the form. The
problem is that when I have Visible="false" the values do not get passed,
but when Visible="true" it works. How can I pass visible="false" text boxes
through the form?
Thank you in advance
Reply to this message...
Goldfarb, Christopher
Josh,
You can't. By setting the TextBoxes to Visible=false, they aren't actually
being rendered (open the source HTML and you'll see). What you can do is
create good old <input type=hidden> HTML tags and fill them with data, like:
<input type=hidden name=myhidden1 value=<asp:Label id=lblhidden1
runat=server />>
Then populate lblhidden1 as needed in the page_load event, or after whatever
event is fired you need.
// Regards,
Chris
[Original message clipped]
Reply to this message...
Goldfarb, Christopher
Josh,
Actually even better would be to use
HtmlInputHidden
HTMLControl....
[Original message clipped]
Reply to this message...
Casey Chesnut
Just programatically stuff values into the statebag,
and then you dont even have to mess with a control in the presentation,
because the value will be in the __viewstate hidden feild that is already
there.
//set
string s = "hello world";
this.State.Add("userKey", s);
//get
string s2 = (string) this.State["userKey"];
casey chesnut
-----Original Message-----
From: Goldfarb, Christopher [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, May 01, 2001 6:53 PM
To: aspngbeta
Subject: [aspngbeta] RE: passing hidden values
Josh,
Actually even better would be to use
HtmlInputHidden
HTMLControl....
[Original message clipped]
| [aspngbeta] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngbeta.asp
= JOIN/QUIT
Reply to this message...
Goldfarb, Christopher
Even better. Thanks for the suggestion.
One question - is there a performance difference between casting a value to
string as opposed to using the ToString() method?
Regards,
// Chris
[Original message clipped]
Reply to this message...
Casey Chesnut
had not tried that, but it worked as well:
string s3 = this.State["userKey"].ToString();
i tried comparing the 2 down to the 100-nanosecond level like this:
DateTime s3Start =
DateTime
.Now;
string s3 = this.State["userKey"].ToString(); //.ToString()
//also for
//string s2 = (string) this.State["userKey"]; //string cast
DateTime s3End =
DateTime
.Now;
long c = s3Start.Ticks;
long d = s3End.Ticks;
long s3Total = d - c;
ended up the start and end times were the same for both,
so i have no clue which is faster ...
and am unsure how to get a lower level granularity for timing :(
casey chesnut
-----Original Message-----
From: Goldfarb, Christopher [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, May 02, 2001 9:36 AM
To: aspngbeta
Subject: [aspngbeta] RE: passing hidden values
Even better. Thanks for the suggestion.
One question - is there a performance difference between casting a value to
string as opposed to using the ToString() method?
Regards,
// Chris
[Original message clipped]
| [aspngbeta] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngbeta.asp
= JOIN/QUIT
Reply to this message...
Scott Worley
if you are using the hidden text box's to pass additional values to the form
for processing, there is a abetter way in ASP.NET, use the web form State
bag, it is used like the Session and Application objects
this maintains the vairable only for the duration of the actual web page
scott worley
----- Original Message -----
From: "Goldfarb, Christopher" <
Click here to reveal e-mail address
>
To: "aspngbeta" <
Click here to reveal e-mail address
>
Sent: Tuesday, May 01, 2001 7:52 PM
Subject: [aspngbeta] RE: passing hidden values
[Original message clipped]
Reply to this message...
Das (VIP)
Christopher,
I am having a question for you. In your statement,
[Original message clipped]
you are assigning the output of label countrol to the value of a hidden
type.
if you declare <asp:label id=l1 runat=server />
the HTML output will be some what like this
<span id=l1>this is a test</span>
so this entire string would be assigned to the hidden control myhidden1.
this is not what we wanted.
according to me, we can declare the hidden control as
<input type=hidden name=myhidden1 runat=server />
then in the one of the event, we can accees this hidden control as
myhidden1.text = "test"
Correct me, If I am wrong.
thanks,
DAS.
----- Original Message -----
From: "Goldfarb, Christopher" <
Click here to reveal e-mail address
>
To: "aspngbeta" <
Click here to reveal e-mail address
>
Sent: Tuesday, May 01, 2001 6:38 PM
Subject: [aspngbeta] RE: passing hidden values
[Original message clipped]
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
Reply to this message...
System.DateTime
System.Web.UI.HtmlControls.HtmlInputHidden
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com