Hi all,
I have used the following code for doing the form
submission. I don't think this is a right way to submit a
from to a new aspx page because I need to add a dummy form
in between.
Could anyone tell me a proper way to do this?
Looking forward to your reply. Thanks!
Chung
My code:
<form id="Form1" method="post" runat="server">
<asp:Button id="Reset_btn" style="Z-INDEX: 125;
LEFT: 853px; POSITION: absolute; TOP: 504px"
runat="server" Width="82px" Height="59px"
Text="Postback" ></asp:Button>
<form id="Dummy_Form" >
</form>
<form id="Form2" method="post" action="New.asp x">
<INPUT style="Z-INDEX: 105; LEFT: 22px; WIDTH:
224px; POSITION: absolute; TOP: 11px; HEIGHT: 42px"
type="submit" value="Submit to New page">
</form>
</form> 3 2259
In .NET your forms submit to themselves (which is called a postback). On
the second (or subsequent page load) you can retrieve the values from your
form elements like this:
Sub Page_Load()
If Not IsPostBack Then 'First time the page is loading
Else 'Second or subsequent time the
page is loading
End If
End Sub
If you want to redirect to another page, use response.redire ct,
server.transfer or server.execute.
"Chung" <an*****@hotmai l.com> wrote in message
news:08******** *************** *****@phx.gbl.. . Hi all,
I have used the following code for doing the form submission. I don't think this is a right way to submit a from to a new aspx page because I need to add a dummy form in between. Could anyone tell me a proper way to do this?
Looking forward to your reply. Thanks!
Chung
My code:
<form id="Form1" method="post" runat="server"> <asp:Button id="Reset_btn" style="Z-INDEX: 125; LEFT: 853px; POSITION: absolute; TOP: 504px" runat="server" Width="82px" Height="59px" Text="Postback" ></asp:Button> <form id="Dummy_Form" > </form> <form id="Form2" method="post" action="New.asp x"> <INPUT style="Z-INDEX: 105; LEFT: 22px; WIDTH: 224px; POSITION: absolute; TOP: 11px; HEIGHT: 42px" type="submit" value="Submit to New page"> </form> </form>
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)
'Add data to the context object before transferring
Context.Items(" myParameter") = x
Server.Transfer ("WebForm2.aspx ")
Then, in WebForm2.aspx:
'Grab data from the context property
Dim x as Integer = CType(Context.I tems("myParamet er"),Integer)
Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide. http://msdn.microsoft.com/msdnmag/is...e/default.aspx http://www.aspalliance.com/kenc/passval.aspx http://www.dotnetjunkies.com/tutoria...tutorialid=600 http://www.dotnetbips.com/displayarticle.aspx?id=79
--
I hope this helps,
Steve C. Orr, MCSD, MVP http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
"Chung" <an*****@hotmai l.com> wrote in message
news:08******** *************** *****@phx.gbl.. . Hi all,
I have used the following code for doing the form submission. I don't think this is a right way to submit a from to a new aspx page because I need to add a dummy form in between. Could anyone tell me a proper way to do this?
Looking forward to your reply. Thanks!
Chung
My code:
<form id="Form1" method="post" runat="server"> <asp:Button id="Reset_btn" style="Z-INDEX: 125; LEFT: 853px; POSITION: absolute; TOP: 504px" runat="server" Width="82px" Height="59px" Text="Postback" ></asp:Button> <form id="Dummy_Form" > </form> <form id="Form2" method="post" action="New.asp x"> <INPUT style="Z-INDEX: 105; LEFT: 22px; WIDTH: 224px; POSITION: absolute; TOP: 11px; HEIGHT: 42px" type="submit" value="Submit to New page"> </form> </form>
Thanks Steve,
This really helps me a lot. When I am using the
context.Items control, it comes up another problem. I case
I have 100 textbox in my form then I have to add 100
context items in Context.Items.
Is there any way to get all the form control from my form
at a time? Then I can use foreach loop to get all the
value.
Chung -----Original Message----- Here's a nice, simple way to pass values from one page to
another:(VB.NET code)
'Add data to the context object before transferring Context.Items( "myParamete r") = x Server.Transfe r("WebForm2.asp x")
Then, in WebForm2.aspx:
'Grab data from the context property Dim x as Integer = CType(Context.I tems
("myParameter") ,Integer) Of course there are a number of ways to pass values from
one page toanother, such as using the querystring, cookies, session, context, saving to a temporary table in the database
between each page, etc.You'll have to decide which technique is best for your
application.Here are several good articles on the subject to help you
decide.http://msdn.microsoft.com/msdnmag/is...04/ASPNETUserS
tate/default.aspx http://www.aspalliance.com/kenc/passval.aspx
http://www.dotnetjunkies.com/tutoria...tutorialid=600
http://www.dotnetbips.com/displayarticle.aspx?id=79
-- I hope this helps, Steve C. Orr, MCSD, MVP http://Steve.Orr.net Hire top-notch developers at http://www.able-
consulting.com
"Chung" <an*****@hotmai l.com> wrote in message news:08******* *************** ******@phx.gbl. .. Hi all,
I have used the following code for doing the form submission. I don't think this is a right way to submit
a from to a new aspx page because I need to add a dummy
form in between. Could anyone tell me a proper way to do this?
Looking forward to your reply. Thanks!
Chung
My code:
<form id="Form1" method="post" runat="server"> <asp:Button id="Reset_btn" style="Z-INDEX: 125; LEFT: 853px; POSITION: absolute; TOP: 504px" runat="server" Width="82px" Height="59px" Text="Postback" ></asp:Button> <form id="Dummy_Form" > </form> <form id="Form2" method="post" action="New.asp x"> <INPUT style="Z-INDEX: 105; LEFT: 22px; WIDTH: 224px; POSITION: absolute; TOP: 11px; HEIGHT: 42px" type="submit" value="Submit to New page"> </form> </form>
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Matt |
last post by:
I want to submit the form to the server without opening another page.
When we do the following, it will submit the form data in myform to
the IIS, and open page2.asp.
<form name="myform" action="page2.asp" method="post">
But I don't want to open another page, I just want to submit the form data.
Should I do the following??
myform.submit();
|
by: Terence Parker |
last post by:
How does one go about submitting a form with a link - but submitting
it to a new window AND to a page different to that described within
the action="" option of the <form> tag?
Say, for example, I have a simple form such as the following:
<form method="POST" action="submit.php" name="AForm">
Name: <input type="text" name="Name" length="20"><br>
Age: 15 <a href="age.php">change age</a><br>
<input type="submit" name="submit"...
|
by: M Smith |
last post by:
I have a form I want to submit to itself. I want to be able to type in a
list of numbers and submit the form and have that list show up on the same
form under the text box I typed them into and the buttons. The problem is
when I post a form to itself, the Enter key will not submit the form, it
only clears the contents of the text box. The only way I can submit is to
click the submit button. Here is a simplified version of my code that I...
|
by: CJM |
last post by:
Can somebody clarify if/how/when a simple form is submitted when the <Enter>
key is pressed?
As I understood it, if you have a form with a single submit button, if enter
is pressed, the form should be submitted as if the button is pressed. Is
this correct?
Does this behaviour vary across browsers?
Chris
|
by: rjames.clarke |
last post by:
I have the following.
$result=mysql_query($sql);
$nrows=mysql_num_rows($result);
for ($i=0;$i<$nrows;$i++)
{
$row_array=mysql_fetch_row($result);
echo "<form name='testform' action='ins_op.php' method='post'>";
lots of form stuff
| |
by: Eric George |
last post by:
Hi,
Has anyone had any success using jscript submit
method in their VS.NET projects?
For example I have some client processing in a script
function then call <form name>.submit();
This won't work. It does however work in a hand coded
html or aspx page.
|
by: kkuniya |
last post by:
Situation :
- A form (method : POST, action : itself, onsubmit : alert 'Submit' )
- Got 2 submit button ( 'Save' , 'View')
- Got navigation 1|2|3|4
What I want to do :
- Once clicked on the navigation page, it will save the page without
need to click on 'Save' button. Currently, if i manually clicked on the
'Save' button; it will save the page.
|
by: Alex |
last post by:
Hello,
I hope I can explain this properly. I'm writing an application with a
tabbed-based navigation, and a form which gets filled out by users will
be split into 5 subtabs. What I need is instead of the user needing to
hit a SUBMIT button each time the form within a tab is complete (Before
clicking the next tab), I want clicking any tab to submit the data.
I'm affraid that by not doing this, people will fill out the data in
tab 1,...
|
by: j1dopeman |
last post by:
Hi,
I'd like to use a button to save and then submit a form. I can set
the onlick of the button to mahButton_click or submit, but I can't
figure out how to do both.
It looks like c# can't call a form's submit. I've found how to post
programatically, but I need to use the form's target attribute so that
the response goes into another frame, and I can't figure out how to do
that programatically.
|
by: Frinavale |
last post by:
I've been trying all morning to cancel a form submit to the server.
I have a JavaScript Object that determines whether or not the page should be submitted to the server depending on whether the user clicks "yes" or "no".
This Object is attached to various HTML elements on the page (buttons, selects etc) and traps any events that they raise that cause the page to submit.
If the user has not responded, the Object should cancel the page...
|
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...
| |
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,...
|
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...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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();...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |