473,320 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to pass an ID in hidden variable.

Ok, this is probably so simple...
Anyway, I'd like to pass a value in the hidden variable. I have code
like this:

<form...>
<input type="Hidden" name="zzz" value="1">
...
</form>

I want to replace the value with another when the page gets generated in
the code behind file. How do I do such a thing?

Regards
Nov 18 '05 #1
6 3346
I'd try to avoid that if at all possible, spoofing hidden fields is a known
hack and I was at DevDays ASP.NET Security discussion and they were
recommended against using Hidden fields for input. I think Session State
should get you what you need and session variables are really easy to use.
Are you familiar with them? If not, I'd really suggest checking them out.

Cheers,

Bill
"Frank Rizzo" <no**@none.com> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl...
Ok, this is probably so simple...
Anyway, I'd like to pass a value in the hidden variable. I have code
like this:

<form...>
<input type="Hidden" name="zzz" value="1">
...
</form>

I want to replace the value with another when the page gets generated in
the code behind file. How do I do such a thing?

Regards

Nov 18 '05 #2
Use an HtmlInputHidden Control.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Frank Rizzo" <no**@none.com> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl...
Ok, this is probably so simple...
Anyway, I'd like to pass a value in the hidden variable. I have code
like this:

<form...>
<input type="Hidden" name="zzz" value="1">
...
</form>

I want to replace the value with another when the page gets generated in
the code behind file. How do I do such a thing?

Regards

Nov 18 '05 #3
He didn't mention whether this information is sensitive or not, only that it
is in a hidden form field. There are plenty of good reasons for putting data
that you don't want displayed into a hidden form field. ViewState, for
example, comes to mind...

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:uc*************@TK2MSFTNGP11.phx.gbl...
I'd try to avoid that if at all possible, spoofing hidden fields is a known hack and I was at DevDays ASP.NET Security discussion and they were
recommended against using Hidden fields for input. I think Session State
should get you what you need and session variables are really easy to use.
Are you familiar with them? If not, I'd really suggest checking them out.

Cheers,

Bill
"Frank Rizzo" <no**@none.com> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl...
Ok, this is probably so simple...
Anyway, I'd like to pass a value in the hidden variable. I have code
like this:

<form...>
<input type="Hidden" name="zzz" value="1">
...
</form>

I want to replace the value with another when the page gets generated in
the code behind file. How do I do such a thing?

Regards


Nov 18 '05 #4
"That's FRANK RIZZO, I said!!!!"

Sorry I couldn't resist the Jerky Boy reference.
No offense intended for the original poster Frank (the former Philly,PA
Mayor?)
It's Friday, you know..

Carry on!
--
Peter O'Reilly

P.S. You are correct, FWIW
Nov 18 '05 #5
Peter O'Reilly wrote:
"That's FRANK RIZZO, I said!!!!"

Sorry I couldn't resist the Jerky Boy reference.
No offense intended for the original poster Frank (the former Philly,PA
Mayor?)
It's Friday, you know..


All, you silly little freak. You gonna answer the question or not?
Nov 18 '05 #6
In your example...
<input type="Hidden" name="zzz" value="1">
add an id attribute, i.e. id="zzz" and the runat=server, attrribute/value
pair.

Afterwards, if the VS.NET editor does not already do so, you should add the
following delcaration
to your code behind file:
protected System.Web.UI.HtmlControls.HtmlInputHidden zzz;

You will now have server-code access to the hidden html field.

Peter
--
Peter O'Reilly
"Frank Rizzo" <no****@nospam.com> wrote in message
news:un**************@tk2msftngp13.phx.gbl...
Peter O'Reilly wrote:
"That's FRANK RIZZO, I said!!!!"

Sorry I couldn't resist the Jerky Boy reference.
No offense intended for the original poster Frank (the former Philly,PA
Mayor?)
It's Friday, you know..


All, you silly little freak. You gonna answer the question or not?

Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Wayne Wengert | last post by:
I have an application where a session variable is set in an ASPX page, The process calls an ASP page and when in that page the session variable appears to be null. How can I pass a session variable...
10
by: Frank Rizzo | last post by:
Ok, this is probably so simple... Anyway, I'd like to pass a value in the hidden variable. I have code like this: <form...> <input type="Hidden" name="zzz" value="1"> ... </form> I want...
1
by: drec | last post by:
I need to pass a variable from script1.php to script2.php. The problem is that these scripts use frames and therefore I am able to pass the variable through the URL. It also does not use forms to...
3
by: Steve Kershaw | last post by:
Hi, I need to pass a value from a hidden input: <input id="hiddentxtWidth" type="hidden" value="1065" /> to a JavaScript function. I've tried the following: <script type="text/javascript" >...
4
by: IRC | last post by:
hey, i am pretty new on javascript as well as PHP, Hey, anyone can you help me, how to pass the javascript array value to php page......... i want to retrieve the values which are arrayed on...
4
by: akshay01 | last post by:
Hi All, I am using the following code in which i am creating some textboxes and and as the for loop continues the name of the textboxes will also be unique for all the textboxes. now i want to...
12
by: Bryan Parkoff | last post by:
I write my large project in C++ source code. My C++ source code contains approximate four thousand small functions. Most of them are inline. I define variables and functions in the global scope....
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
9
by: JRough | last post by:
I tried to pass the $result from a mysql_query in a url like this line Header("Location:clm_historyXL.php?_result=".$result); but on the redirect location clm_history.php page I get an error on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.