In ASP, if I have asppage.asp for GUI and aspprocess.asp for process requests from database. In asppage.asp code will be like: <form action="aspprocess.asp" method="POST"> GUI CODE </form> When the user clicks the submit button on asppage.asp, it will invoke aspprocess.asp page aspprocess.asp code can get the user input from asppage.asp by doing: Request.Form("Control_ID") In ASP.NET, if I want to achieve the same goal: if I have aspxpage.aspx for GUI and aspxprocess.aspx for process requests from database In aspxpage.aspx code will be like: <form id="Form1" method="post" action="aspxprocess.aspx" runat="server"> GUI CODE </form> However, when the user clicks the submit button on aspxpage.aspx, it didn't invoke aspxpage.aspx page at all, unless I do the the following: Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit1.ServerClick Response.Redirect("aspxprocess.aspx") End Sub But even now I am in aspxprocess.aspx page, how can I get the user input from aspxpage.aspx?? Request.Form("Control_ID") no longer works. Please advise! Thanks!
Try this? http://authors.aspalliance.com/kenc/passval.aspx [quoted text, click to view] "Matthew Louden" <mattloude@hotmail.com> wrote in message news:udx9KqJsDHA.1872@TK2MSFTNGP09.phx.gbl... > In ASP, if I have asppage.asp for GUI and aspprocess.asp for process > requests from database. > > In asppage.asp code will be like: > <form action="aspprocess.asp" method="POST"> GUI CODE </form> > > When the user clicks the submit button on asppage.asp, it will invoke > aspprocess.asp page > > aspprocess.asp code can get the user input from asppage.asp by doing: > Request.Form("Control_ID") > > In ASP.NET, if I want to achieve the same goal: if I have aspxpage.aspx for > GUI and aspxprocess.aspx for process requests from database > > In aspxpage.aspx code will be like: > <form id="Form1" method="post" action="aspxprocess.aspx" runat="server"> GUI > CODE </form> > > However, when the user clicks the submit button on aspxpage.aspx, it didn't > invoke aspxpage.aspx page at all, unless I do the the following: > > Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles Submit1.ServerClick > Response.Redirect("aspxprocess.aspx") > End Sub > > But even now I am in aspxprocess.aspx page, how can I get the user input > from aspxpage.aspx?? > Request.Form("Control_ID") no longer works. > > Please advise! > Thanks! > >
Setting the form action attribute just isn't the ASP.NET way. 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/issues/03/04/ASPNETUserState/default.aspx http://www.aspalliance.com/kenc/passval.aspx http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=600 http://www.dotnetbips.com/displayarticle.aspx?id=79 Here's one nice, simple way to pass values from one page to another: '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.Items("myParameter"),Integer) -- I hope this helps, Steve C. Orr, MCSD, MVP http://Steve.Orr.net Hire top-notch developers at http://www.able-consulting.com [quoted text, click to view] "Matthew Louden" <mattloude@hotmail.com> wrote in message news:udx9KqJsDHA.1872@TK2MSFTNGP09.phx.gbl... > In ASP, if I have asppage.asp for GUI and aspprocess.asp for process > requests from database. > > In asppage.asp code will be like: > <form action="aspprocess.asp" method="POST"> GUI CODE </form> > > When the user clicks the submit button on asppage.asp, it will invoke > aspprocess.asp page > > aspprocess.asp code can get the user input from asppage.asp by doing: > Request.Form("Control_ID") > > In ASP.NET, if I want to achieve the same goal: if I have aspxpage.aspx for > GUI and aspxprocess.aspx for process requests from database > > In aspxpage.aspx code will be like: > <form id="Form1" method="post" action="aspxprocess.aspx" runat="server"> GUI > CODE </form> > > However, when the user clicks the submit button on aspxpage.aspx, it didn't > invoke aspxpage.aspx page at all, unless I do the the following: > > Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles Submit1.ServerClick > Response.Redirect("aspxprocess.aspx") > End Sub > > But even now I am in aspxprocess.aspx page, how can I get the user input > from aspxpage.aspx?? > Request.Form("Control_ID") no longer works. > > Please advise! > Thanks! > >
If you absolutely must allow ASPXPAGE to pass the form like classic ASP, turn off PostBack on the page. However, as others have noted, in ASP.Net, there are good reasons for allowing the postback to happen (e.g. control validation), so be sure you've thought it all through before you proceed. Erik J Sawyer, Webmaster Kingsport City Schools [quoted text, click to view] >-----Original Message----- >In ASP, if I have asppage.asp for GUI and aspprocess.asp for process >requests from database. > >In asppage.asp code will be like: ><form action="aspprocess.asp" method="POST"> GUI CODE </form> > >When the user clicks the submit button on asppage.asp, it will invoke >aspprocess.asp page > >aspprocess.asp code can get the user input from asppage.asp by doing: >Request.Form("Control_ID") > >In ASP.NET, if I want to achieve the same goal: if I have aspxpage.aspx for >GUI and aspxprocess.aspx for process requests from database > >In aspxpage.aspx code will be like: ><form id="Form1" method="post" action="aspxprocess.aspx" runat="server"> GUI >CODE </form> > >However, when the user clicks the submit button on aspxpage.aspx, it didn't >invoke aspxpage.aspx page at all, unless I do the the following: > >Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As >System.EventArgs) Handles Submit1.ServerClick > Response.Redirect("aspxprocess.aspx") >End Sub > >But even now I am in aspxprocess.aspx page, how can I get the user input >from aspxpage.aspx?? >Request.Form("Control_ID") no longer works. > >Please advise! >Thanks!
Not sure if this is what you're looking for...but... In all of my aspx pages that needed processing...I've used codebehind pages to process the form. Makes things alot easier, simpler, and faster. Simply tie the submit button to a sub which processes the data you're trying to move. It's already on the page....so calling the code behind page will just be a matter of: Dim uEmail as string = Email.Text There's just so much to do using that method...and there are quite a few books out there already...so I don't want to aggrivate people by writing one here....LOL [quoted text, click to view] "Matthew Louden" <mattloude@hotmail.com> wrote in message news:udx9KqJsDHA.1872@TK2MSFTNGP09.phx.gbl... > In ASP, if I have asppage.asp for GUI and aspprocess.asp for process > requests from database. > > In asppage.asp code will be like: > <form action="aspprocess.asp" method="POST"> GUI CODE </form> > > When the user clicks the submit button on asppage.asp, it will invoke > aspprocess.asp page > > aspprocess.asp code can get the user input from asppage.asp by doing: > Request.Form("Control_ID") > > In ASP.NET, if I want to achieve the same goal: if I have aspxpage.aspx for > GUI and aspxprocess.aspx for process requests from database > > In aspxpage.aspx code will be like: > <form id="Form1" method="post" action="aspxprocess.aspx" runat="server"> GUI > CODE </form> > > However, when the user clicks the submit button on aspxpage.aspx, it didn't > invoke aspxpage.aspx page at all, unless I do the the following: > > Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles Submit1.ServerClick > Response.Redirect("aspxprocess.aspx") > End Sub > > But even now I am in aspxprocess.aspx page, how can I get the user input > from aspxpage.aspx?? > Request.Form("Control_ID") no longer works. > > Please advise! > Thanks! > >
In ASP. Net You Can not submit your page to another form. It always post back to the same page. Here are three links that will help you solove your probelm. They are many solutions. But I will tell you one of them. It is called QueryString. Sub Button1_Click(sender as object, e as EventArgs) Response.Redirect("asppage.aspx?name=" & name.Text) End Sub And in the process page you can call it by Sub Page_Load(sender as object, e as EventArgs) Request.QueryString("name") End Sub For more information you can visit. http://www.stardeveloper.com/articles/display.html?article=2003061901&page=1 http://www.dotnetbips.com/displayarticle.aspx?id=79 http://authors.aspalliance.com/wisemonk/print.aspx?id=AN012522 Regards, Fah@d ;) [quoted text, click to view] "Matthew Louden" <mattloude@hotmail.com> wrote in message news:udx9KqJsDHA.1872@TK2MSFTNGP09.phx.gbl... > In ASP, if I have asppage.asp for GUI and aspprocess.asp for process > requests from database. > > In asppage.asp code will be like: > <form action="aspprocess.asp" method="POST"> GUI CODE </form> > > When the user clicks the submit button on asppage.asp, it will invoke > aspprocess.asp page > > aspprocess.asp code can get the user input from asppage.asp by doing: > Request.Form("Control_ID") > > In ASP.NET, if I want to achieve the same goal: if I have aspxpage.aspx for > GUI and aspxprocess.aspx for process requests from database > > In aspxpage.aspx code will be like: > <form id="Form1" method="post" action="aspxprocess.aspx" runat="server"> GUI > CODE </form> > > However, when the user clicks the submit button on aspxpage.aspx, it didn't > invoke aspxpage.aspx page at all, unless I do the the following: > > Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles Submit1.ServerClick > Response.Redirect("aspxprocess.aspx") > End Sub > > But even now I am in aspxprocess.aspx page, how can I get the user input > from aspxpage.aspx?? > Request.Form("Control_ID") no longer works. > > Please advise! > Thanks! > >
Don't see what you're looking for? Try a search.
|