473,586 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.Net Form Posting

av
hi,I have couple of Questions regarding the ASP.NET.

Post the Values from WebPage1.aspx to WebPage2.aspx

The code i have is in webpage1.aspx
<form action="webpage 2.aspx" method=post runat="server">
<asp:TextBox id="TextBox1" runat="server"> </asp:TextBox>
<asp:TextBox id="TextBox2" runat="server"> </asp:TextBox>
<asp:Button id="Button1" runat="server"
Text="Button"></asp:Button>
How is the Post done using Button Server Control ?? in
Regular ASP v use the <Input and set the type to sumbit>
for the post to occur !
I am able to add <Script> tags but the content is not
executed !! I tried to use the onclik() event which i
wrote in the <script> for the Button, but it doesnt seem
to wrok.

If i have the Server Controls i am not able to post the
form.
if i remove the "runat=serv er" from the FORM tag and
replace the <asp> controls with <input> regular HTML
controls the post works.

Please let me know where exactly the problem is . ...early
response is appericiated !!!
Nov 17 '05 #1
2 1214
The form is set to post back to itself once you start using server controls.
You need to fundamentally change how you work with web applications. Instead
of using a second page, use the same page and check the Form.IsPostBack
value to determine what you are doing at the time. Then, you can work with
the controls that you declared in the code behind in order to read. It's an
object oriented design paradigm now.

So, assuming you are collecting from two text boxes:

1. Set up declarations of both text boxes in the code behind
2. In the pageload event, check to see if you are in post back
3. If so, then you can get the values of the controls using the local
variables you have and write them to the database
4. Once you are done, you can response.redire ct or server.transfer to
another page, or whatever you want to do next.

Everything is kept together and is neatly declared as objects - it takes
some getting used to if you are used to ASP Classic, but once you get used
to it you'll like it a lot better.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows XP
Windows XP Associate Expert
--
"av" <an*********@ho tmail.com> wrote in message
news:04******** *************** *****@phx.gbl.. .
hi,I have couple of Questions regarding the ASP.NET.

Post the Values from WebPage1.aspx to WebPage2.aspx

The code i have is in webpage1.aspx
<form action="webpage 2.aspx" method=post runat="server">
<asp:TextBox id="TextBox1" runat="server"> </asp:TextBox>
<asp:TextBox id="TextBox2" runat="server"> </asp:TextBox>
<asp:Button id="Button1" runat="server"
Text="Button"></asp:Button>
How is the Post done using Button Server Control ?? in
Regular ASP v use the <Input and set the type to sumbit>
for the post to occur !
I am able to add <Script> tags but the content is not
executed !! I tried to use the onclik() event which i
wrote in the <script> for the Button, but it doesnt seem
to wrok.

If i have the Server Controls i am not able to post the
form.
if i remove the "runat=serv er" from the FORM tag and
replace the <asp> controls with <input> regular HTML
controls the post works.

Please let me know where exactly the problem is . ...early
response is appericiated !!!

Nov 17 '05 #2
av
Thanks chris for the info.. Any good books or white papers
which gives me the precise info like managing sessions,
the current application i am using Session UserName and
Pwd validation from a COM object.. any better suggestion
on handling session i mean to use ASP.net features ?
and other quesiton on the <script> tags.. for some reason
i am getting an execption on namespace.. please let me
know on this.... thanks once again for prompt response...

-----Original Message-----
The form is set to post back to itself once you start using server controls.You need to fundamentally change how you work with web applications. Insteadof using a second page, use the same page and check the Form.IsPostBackvalue to determine what you are doing at the time. Then, you can work withthe controls that you declared in the code behind in order to read. It's anobject oriented design paradigm now.

So, assuming you are collecting from two text boxes:

1. Set up declarations of both text boxes in the code behind2. In the pageload event, check to see if you are in post back3. If so, then you can get the values of the controls using the localvariables you have and write them to the database
4. Once you are done, you can response.redire ct or server.transfer toanother page, or whatever you want to do next.

Everything is kept together and is neatly declared as objects - it takessome getting used to if you are used to ASP Classic, but once you get usedto it you'll like it a lot better.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows XP
Windows XP Associate Expert
--
"av" <an*********@ho tmail.com> wrote in message
news:04******* *************** ******@phx.gbl. ..
hi,I have couple of Questions regarding the ASP.NET.

Post the Values from WebPage1.aspx to WebPage2.aspx

The code i have is in webpage1.aspx
<form action="webpage 2.aspx" method=post runat="server"> <asp:TextBox id="TextBox1" runat="server"> </asp:TextBox>
<asp:TextBox id="TextBox2" runat="server"> </asp:TextBox>
<asp:Button id="Button1" runat="server"
Text="Button"></asp:Button>
How is the Post done using Button Server Control ?? in
Regular ASP v use the <Input and set the type to sumbit>
for the post to occur !
I am able to add <Script> tags but the content is not
executed !! I tried to use the onclik() event which i
wrote in the <script> for the Button, but it doesnt seem
to wrok.

If i have the Server Controls i am not able to post the
form.
if i remove the "runat=serv er" from the FORM tag and
replace the <asp> controls with <input> regular HTML
controls the post works.

Please let me know where exactly the problem is . ...early response is appericiated !!!

.

Nov 17 '05 #3

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

Similar topics

10
4176
by: DaveFash | last post by:
Posting variables from an HTML FORM, via the Request.Form function on the receiving ASP page is great. But how can you POST a Form variable to an ASP page -- without a human pushing a Submit button? An ASP page that can decide when to POST and send the Form vaiables, but out without a
2
22646
by: David N | last post by:
Hi All, The OnLoad() event is invoked automatically when a form is being loaded. Do we have another event that is invoked automatically after a form has completed loading? Thanks.
5
10123
by: Ron Vecchi | last post by:
I know the math I need to perform on width and height to keep an aspect ratio but where and how would I implement keeping a set aspect ratio on a form when a user resizes it. Override OnResize? couldn't quite figure it out. -- Ron Vecchi
8
4925
by: CJack | last post by:
hy, I have an mdi application, i create a child form and I want to know when a button is pressed while that child form is loaded. I have this code: private void frmTestBaby_KeyUp(object sender, System.EventArgs e) { MessageBox.Show("keyboard button pressed!"); } Following is the code to load the frmTestBaby
2
2465
by: Jeff Baker | last post by:
How does one post to an ASPX page using the WebClient when the form name is required?
13
2730
by: Ian.Suttle | last post by:
I am have been researching this issue to no end, so any help would be very much appreciated. I have a page with form tags. Inside of the form tags is a panel that contains a user control. The form tags are NOT inside of the user control. Inside that user control are a few panels that contains different steps of an application (for...
4
5316
by: Lee Chapman | last post by:
Hi, Can anyone tell me why in the code below, the call to ClearChildViewState() has no effect? To paraphrase the code: I'm using view state. I have a textbox and a submit button (and a label that can be ignored). When I press the button the first time, the click handler hides the textbox. Pressing the button a second time unhides the...
22
5073
by: Woody Splawn | last post by:
I am somewhat new to VS.net in general. As a result I am prone to make mistakes. When adding some new feature to a a form it would be nice if I could back it up before trying something that might mess things up. Also, there are times when a new form is enough like an old one that the best way to create the new report is to simply make a...
4
13316
by: Alex Maghen | last post by:
I have a master page which contains a general page framework and also contains a <form runat=server> around most of the content of the page. Inside that <form> tag is a ContentPlaceholder. I then create an ASPX which is tied to that MasterPage and in it a put a bunch of form fields and an <asp:Button />. When I try to run the page, I get......
5
20004
by: Alex Maghen | last post by:
In ASPX 2.0 with MasterPages and all that, my entire page only has one actual <FORM>. But there are several different sections of the page that provide what are functionally separate forms with separate Submit buttons. In basic HTML, I can have multiple forms on a page and the browser knows that if any of the fields for Form A have the...
0
7915
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...
0
7841
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...
0
8204
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. ...
0
8339
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...
0
6617
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...
1
5712
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...
0
5392
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...
0
3838
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...
1
1452
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.