473,385 Members | 1,856 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,385 software developers and data experts.

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="webpage2.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=server" 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 1206
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.redirect 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*********@hotmail.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="webpage2.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=server" 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.redirect 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*********@hotmail.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="webpage2.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=server" 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
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...
2
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
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?...
8
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,...
2
by: Jeff Baker | last post by:
How does one post to an ASPX page using the WebClient when the form name is required?
13
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...
4
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...
22
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...
4
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...
5
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.