473,748 Members | 8,760 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2580
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.t xt" 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.ne t> wrote in message
news:ue******** ********@TK2MSF TNGP09.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.t xt" 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="<%=nTota l%>">

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******@NOyah oo.SPAMcom> wrote in message
news:#m******** ******@TK2MSFTN GP10.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.t xt" 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="<%=nTota l%>">

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******@NOyah oo.SPAMcom> wrote in message
news:%2******** ********@TK2MSF TNGP10.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.t xt" 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="<%=nTota l%>">

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
10155
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 have the function update the target ID with the URL. There is a bit more to it then that, but that is the basics. my difficulty comes when I try to assign a variable to: "document.getElementById('-> var gose here <-').innerHTML"
11
1817
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 standard grey but, if I apply this to an HtmlInput control, all that does is change the background and foreground colours in the textbox portion. Similarly, if I modify the style attribute, that only applies to the textbox portion too.
20
6999
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 = document.getElementById('hometab'); Has anyone ever seen anything like this before, or am I dreaming?
25
9538
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
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9548
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9249
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.