473,405 Members | 2,272 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,405 software developers and data experts.

assigning variable's value to htmlinput

hi all,

in a webform's codebehind, i have a variable (ie: nTotal). and in UI i have
a hidden htmlinput (ie: fld1).
Q: how to assign the value of nTotal to now i want to assign the value of
nTotal to fld1?

many thanks in advance,
andy
Nov 19 '05 #1
6 2561
Andy:
You can't. This is a security feature of HTML and has nothing to do with
ASP.Net. html input values are read only. If they weren't, anyone could
put a hidden html input field and set the value like "c:\passwords.txt" and
when the user clicked any button they'd have their passworsd.txt file
uploaded without ever knowing it.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Newbie" <ad***@remyc.net> wrote in message
news:ue****************@TK2MSFTNGP09.phx.gbl...
hi all,

in a webform's codebehind, i have a variable (ie: nTotal). and in UI i have a hidden htmlinput (ie: fld1).
Q: how to assign the value of nTotal to now i want to assign the value of
nTotal to fld1?

many thanks in advance,
andy

Nov 19 '05 #2
hi all,

(a little correction to mistyped)

in a webform's codebehind, i have a variable (ie: nTotal). and in UI i have
a hidden htmlinput (ie: fld1).
Q: how to assign the value of nTotal to fld1?

many thanks in advance,
andy
Nov 19 '05 #3
Karl Seguin wrote:
Andy:
You can't. This is a security feature of HTML and has nothing to do
with ASP.Net. html input values are read only. If they weren't,
anyone could put a hidden html input field and set the value like
"c:\passwords.txt" and when the user clicked any button they'd have
their passworsd.txt file uploaded without ever knowing it.

?
CMIIW, but that's only true if the input's type is file, and the form's
ENCTYPE attribute is "multipart/form-data".

You need to response.write the variable's value into the html:

<input type="hidden" value="<%=nTotal%>">

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Nov 19 '05 #4
Yes, it's work, Bob.

Thks a lot.

rgds,
andy

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:#m**************@TK2MSFTNGP10.phx.gbl...
Karl Seguin wrote:
Andy:
You can't. This is a security feature of HTML and has nothing to do
with ASP.Net. html input values are read only. If they weren't,
anyone could put a hidden html input field and set the value like
"c:\passwords.txt" and when the user clicked any button they'd have
their passworsd.txt file uploaded without ever knowing it.

?
CMIIW, but that's only true if the input's type is file, and the form's
ENCTYPE attribute is "multipart/form-data".

You need to response.write the variable's value into the html:

<input type="hidden" value="<%=nTotal%>">

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Nov 19 '05 #5
doh...for some reason I read that it was an HtmlFileInput control :)

anyways, why use the old ASP method of Response.WRite? Declare it as a
webcontrol and set the value programatically.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Karl Seguin wrote:
Andy:
You can't. This is a security feature of HTML and has nothing to do
with ASP.Net. html input values are read only. If they weren't,
anyone could put a hidden html input field and set the value like
"c:\passwords.txt" and when the user clicked any button they'd have
their passworsd.txt file uploaded without ever knowing it.

?
CMIIW, but that's only true if the input's type is file, and the form's
ENCTYPE attribute is "multipart/form-data".

You need to response.write the variable's value into the html:

<input type="hidden" value="<%=nTotal%>">

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Nov 19 '05 #6

Karl Seguin wrote:
doh...for some reason I read that it was an HtmlFileInput control :)

anyways, why use the old ASP method of Response.WRite? Declare it as
a webcontrol and set the value programatically.


I'm still in the learning phase myself. My mind is still firmly entrenched
in the classic ASP way of doing things.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Nov 19 '05 #7

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

Similar topics

6
by: adamrfrench | last post by:
Let it be mentioned that Javascript is not my forte, so the solution to this could very well be a simple one. I am working on an AJAX function where I can pass a URL and the target ID in, and...
11
by: Mark Rae | last post by:
Hi, Is there any way to modify the style of the button portion of an HtmlInput control? I have a CSS class which I use for all of the buttons to try to make them a little less ugly than the...
20
by: weston | last post by:
I've got a piece of code where, for all the world, it looks like this fails in IE 6: hometab = document.getElementById('hometab'); but this succeeds: hometabemt =...
25
by: Sourav | last post by:
Suppose I have a code like this, #include <stdio.h> int *p; void foo(int); int main(void){ foo(3); printf("%p %d\n",p,*p);
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: 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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.