473,763 Members | 9,161 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to grant value to a html form hidden field

I have a html form in aspx pages, so how can I grant value to the hidden
field in this form?

For Example:

<body>
<script language="C#" runat="server">

string strTest = "test";
</script>

<form name="try" action="post" >
<input name="test1" type="hidden" />
</form>

How to make test1's value equals to strTest in C# script. Thank you very
much
Oct 16 '06 #1
5 1266
that's not dot net :-)

this is:
<script language="C#" runat="server">
string strTest = "test";

void Page_Load()
{
myHiddenField.v alue = strTest;
}
</script>

<body>
<form id="try" runat="server" >
<asp:hiddenfiel d runat="server" id="myHiddenFie ld" />
</form>
</body>

--

Bruno Alexandre
København, Danmark

"a Portuguese in Denmark"

Blog. http://balexandre.blogspot.com/
Photos. http://www.flickr.com/photos/balexandre/
"David Jia" <ca*****@21cn.c omwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>I have a html form in aspx pages, so how can I grant value to the hidden
field in this form?

For Example:

<body>
<script language="C#" runat="server">

string strTest = "test";
</script>

<form name="try" action="post" >
<input name="test1" type="hidden" />
</form>

How to make test1's value equals to strTest in C# script. Thank you very
much

Oct 16 '06 #2
"David Jia" <ca*****@21cn.c omwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..

David,

Ignore Bruno's reply...
How to make test1's value equals to strTest in C# script. Thank you very
much
<input name="test1" type="hidden" value="<%=strTe st%>" />
Oct 16 '06 #3
or

ClientScript.Re gisterHiddenFie ld(name,value);

-- bruce (sqlwork.com)

"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:ub******** ********@TK2MSF TNGP03.phx.gbl. ..
"David Jia" <ca*****@21cn.c omwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..

David,

Ignore Bruno's reply...
>How to make test1's value equals to strTest in C# script. Thank you very
much

<input name="test1" type="hidden" value="<%=strTe st%>" />

Oct 16 '06 #4
Thank you , the solution you offered works well, thanks a lot to you
again.!!
"Mark Rae" <ma**@markNOSPA Mrae.comдÈëÏûÏ ¢ÐÂÎÅ:ub******* *********@TK2MS FTNGP03.phx.gbl ...
"David Jia" <ca*****@21cn.c omwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..

David,

Ignore Bruno's reply...
>How to make test1's value equals to strTest in C# script. Thank you very
much

<input name="test1" type="hidden" value="<%=strTe st%>" />

Oct 16 '06 #5
"David Jia" <ca*****@21cn.c omwrote in message
news:O$******** ******@TK2MSFTN GP05.phx.gbl...
Thank you , the solution you offered works well, thanks a lot to you
again.!!
Welcome.
Oct 16 '06 #6

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

Similar topics

3
16183
by: Sarah West | last post by:
Hi, I have the following problem; This is my form, i would like to default the select box to USA, and default the text field to a name such as 'Sarah' and the hidden field to another number like '876543', when the user clicks on the check box, otherwise the fields should be blank, the value of the select box dosnt matter much, only that it defaults to USA, when the user checks it. Can anyone help? i have tried a google with no luck,...
16
11501
by: cwizard | last post by:
I'm calling on a function from within this form, and there are values set but every time it gets called I get slammed with a run time error... document.frmKitAmount.txtTotalKitValue is null or not an object... the function is like so: function calc_total() { var x,i,base,margin,total,newmargin,newtotal; base = document.frmKitAmount.txtTotalKitValue.value; margin = document.frmKitAmount.margin.value/100;
1
5591
by: Jim | last post by:
I have a 2 checkboxes and a hidden field..what I want to happen is that you can only click on 1 of these checkboxes at a time and when you check a checkbox it will assign the hidden field "txtreferral" a value and when you uncheck the checkbox it will set the hidden field value back to nothing ..I have the clicking on 1 check box at a time down but when I try to add the code to assign the value to the hidden field I get an error in the...
6
2749
by: charlie_M | last post by:
I figured out via various help from this forum... EXAMPLE: onClick="document.forms.MYBUTTON.value='SIMPLE';document.forms.submit()" In my CGI I see "MYBUTTON" = "SIMPLE" and this works fine.... except that the element MYBUTTON must exist as a hidden field.
8
12105
by: Zlatko Matiæ | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the combobox. What is the solution? Thank you in advance.
2
3277
by: xenophon | last post by:
I added a Hidden Form Field to a form in the code behind. The value is being set in JavaScript client-side, but it is not persisting to the server in the PostBack. I know the value is being set properly because it displays in the document.write method. Create a simple page and paste the below in the code-behind (ASP.NET 1.1-SP1) using System;
4
1603
by: Mangler | last post by:
Without writing a bible on what I'm trying to do I'll see if someone can answer a quick question. I have a form that the user writes a value in a test field. I need to put a hidden value that will take the same number the user inputs and insert it in a form. Basically, I need ...
8
2355
by: Efi Merdler | last post by:
Hi, In my code I'm doing some xml transformation, at the end I receive a fully transformed html file. I'm setting the Value property of an hidden field control to have the content of this html file. In the debugger I can see that the control contains the value correctly, however when the page is displayed in a browser all < symbols are replaced by &lt; .
4
1480
by: AR123 | last post by:
In the field for employee contribution I want to have GBP and make sure that this prints out in the results email. How can I set it up so that the GBP display next to the value in the results email? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Proforma</title> <meta http-equiv=Content-Type content="text/html; charset=windows-1252">
0
9564
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
9387
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
10148
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
10002
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8822
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
7368
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
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.