473,383 Members | 1,859 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,383 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 3349
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: 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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.