473,563 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Asp.net form submit action question

In Asp.net web form under form tag there is action field that I am point to
some other page, and not to same web form. When I run this page it is always
pointing to itself. How do I get around this?

Here is HTML code from webform..

Thanks,

Sinisa

<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Bus inessTest.aspx. vb" Inherits="EDMSe archForms.Busin essTest"
EnableSessionSt ate="True" enableViewState ="True"%>
<%@ Register TagPrefix="uc1" TagName="Busine ssDirectoryUC"
Src="../Forms/BusinessDirecto ryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Business Test</title>
<meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="search1" method="post" runat="server"
action="http://www.techtriangl e.com/search/SearchResultsWa terloo.cfm"
name="search">
<input type="hidden" name="SearchSco pe" value="Business ">
</form>
</body>
</HTML>
Nov 19 '05 #1
12 3430
using the <form runat="server"> you *cannot" have a value for action. All
aspx forms must post back to the same page. If you remove the runat="server"
you may be able to do this; but you have stick to html controls

"TheOne" wrote:
In Asp.net web form under form tag there is action field that I am point to
some other page, and not to same web form. When I run this page it is always
pointing to itself. How do I get around this?

Here is HTML code from webform..

Thanks,

Sinisa

<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Bus inessTest.aspx. vb" Inherits="EDMSe archForms.Busin essTest"
EnableSessionSt ate="True" enableViewState ="True"%>
<%@ Register TagPrefix="uc1" TagName="Busine ssDirectoryUC"
Src="../Forms/BusinessDirecto ryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Business Test</title>
<meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="search1" method="post" runat="server"
action="http://www.techtriangl e.com/search/SearchResultsWa terloo.cfm"
name="search">
<input type="hidden" name="SearchSco pe" value="Business ">
</form>
</body>
</HTML>

Nov 19 '05 #2
You've got to ger rid of the runat=server for the form. An ASP.Net form must
post back to itself to handle certain kinds of events, like catching a
button's click by the server.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"TheOne" <Th****@noemail .nospam> wrote in message
news:uh******** ******@TK2MSFTN GP12.phx.gbl...
In Asp.net web form under form tag there is action field that I am point
to
some other page, and not to same web form. When I run this page it is
always
pointing to itself. How do I get around this?

Here is HTML code from webform..

Thanks,

Sinisa

<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Bus inessTest.aspx. vb" Inherits="EDMSe archForms.Busin essTest"
EnableSessionSt ate="True" enableViewState ="True"%>
<%@ Register TagPrefix="uc1" TagName="Busine ssDirectoryUC"
Src="../Forms/BusinessDirecto ryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Business Test</title>
<meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="search1" method="post" runat="server"
action="http://www.techtriangl e.com/search/SearchResultsWa terloo.cfm"
name="search">
<input type="hidden" name="SearchSco pe" value="Business ">
</form>
</body>
</HTML>

Nov 19 '05 #3
I have to use server controls since I will be putting in user control for
it. Is it possible to use response.redire ct to submit form? Is there some
other solution. Somehow I need to post information from this form.

Thanks,

Sinisa

"TheOne" <Th****@noemail .nospam> wrote in message
news:uh******** ******@TK2MSFTN GP12.phx.gbl...
In Asp.net web form under form tag there is action field that I am point to some other page, and not to same web form. When I run this page it is always pointing to itself. How do I get around this?

Here is HTML code from webform..

Thanks,

Sinisa

<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Bus inessTest.aspx. vb" Inherits="EDMSe archForms.Busin essTest"
EnableSessionSt ate="True" enableViewState ="True"%>
<%@ Register TagPrefix="uc1" TagName="Busine ssDirectoryUC"
Src="../Forms/BusinessDirecto ryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Business Test</title>
<meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="search1" method="post" runat="server"
action="http://www.techtriangl e.com/search/SearchResultsWa terloo.cfm"
name="search">
<input type="hidden" name="SearchSco pe" value="Business ">
</form>
</body>
</HTML>

Nov 19 '05 #4
AP.NET 2.0 solves this issue. However, its only in BETA. So, you can't
have the best of both worlds. Either you stick with the current model by
having the form post back to itself or do as we suggested. If that doesn't
work for you. Then maybe asp.net is not the right solution for you. Give
classic ASP a try. :-)

"TheOne" wrote:
I have to use server controls since I will be putting in user control for
it. Is it possible to use response.redire ct to submit form? Is there some
other solution. Somehow I need to post information from this form.

Thanks,

Sinisa

"TheOne" <Th****@noemail .nospam> wrote in message
news:uh******** ******@TK2MSFTN GP12.phx.gbl...
In Asp.net web form under form tag there is action field that I am point

to
some other page, and not to same web form. When I run this page it is

always
pointing to itself. How do I get around this?

Here is HTML code from webform..

Thanks,

Sinisa

<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Bus inessTest.aspx. vb" Inherits="EDMSe archForms.Busin essTest"
EnableSessionSt ate="True" enableViewState ="True"%>
<%@ Register TagPrefix="uc1" TagName="Busine ssDirectoryUC"
Src="../Forms/BusinessDirecto ryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Business Test</title>
<meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="search1" method="post" runat="server"
action="http://www.techtriangl e.com/search/SearchResultsWa terloo.cfm"
name="search">
<input type="hidden" name="SearchSco pe" value="Business ">
</form>
</body>
</HTML>


Nov 19 '05 #5
"TheOne" <Th****@noemail .nospam> wrote in message
news:uh******** ******@TK2MSFTN GP12.phx.gbl...
In Asp.net web form under form tag there is action field that I am point to some other page, and not to same web form. When I run this page it is always pointing to itself. How do I get around this?

Here is HTML code from webform..

Thanks,

Sinisa


To transfer to another webpage look into one of these three options:
Response.Redire ct
Server.Transfer
Server.Execute

Managing ASP.NET Navigation
http://www.ondotnet.com/pub/a/dotnet...aspnetnav.html

Hope this helps,
Steve-O

Nov 19 '05 #6
I'm trying to do something similar, to do a POST to paypal. In my quick
testing, I don't see that removing runat=server and using server controls are
mutually exclusive, it's just that you can't process any events from those
controls (which you don't care about, because you're off to another page
anyway).

In my test, I have a single placeholder on the form, and the <form> has
"runat=serv er" gone, method="post" and action="paypal, etc.". In the
code-behind I add htmlinputhidden fields to the placeholder for all my
name/value pairs (appears that I have to set id= for each, which sets both
name= and id=, not sure why).

When I submit this form it goes to paypal with the post values as planned.
Last piece I'm working on is to do the submit automatically, which per
various posts out here I think I can do as document.forms[0].submit().

hth,

Bill

"TheOne" wrote:
In Asp.net web form under form tag there is action field that I am point to
some other page, and not to same web form. When I run this page it is always
pointing to itself. How do I get around this?

Here is HTML code from webform..

Thanks,

Sinisa

<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Bus inessTest.aspx. vb" Inherits="EDMSe archForms.Busin essTest"
EnableSessionSt ate="True" enableViewState ="True"%>
<%@ Register TagPrefix="uc1" TagName="Busine ssDirectoryUC"
Src="../Forms/BusinessDirecto ryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Business Test</title>
<meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="search1" method="post" runat="server"
action="http://www.techtriangl e.com/search/SearchResultsWa terloo.cfm"
name="search">
<input type="hidden" name="SearchSco pe" value="Business ">
</form>
</body>
</HTML>

Nov 19 '05 #7
What is the "proper" way to programmaticall y call another page in your app
while passing it information? QueryString has length limitations, Session
would seem to be an improper place for page-to-page, but Context.Items don't
actually get saved to the page source, so there's no "history" with those.
I'm curious what the right way is because I'm struggling with related
issues, and right now, I'm dropping a webcontrol on my pages called
ContextItemRete ntionBlock that renders hidden inputs with those values to
the page so that they don't get lost with the context.

"Mark Fitzpatrick" <ma******@fitzm e.com> wrote in message
news:uW******** ******@TK2MSFTN GP09.phx.gbl...
You've got to ger rid of the runat=server for the form. An ASP.Net form
must post back to itself to handle certain kinds of events, like catching
a button's click by the server.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"TheOne" <Th****@noemail .nospam> wrote in message
news:uh******** ******@TK2MSFTN GP12.phx.gbl...
In Asp.net web form under form tag there is action field that I am point
to
some other page, and not to same web form. When I run this page it is
always
pointing to itself. How do I get around this?

Here is HTML code from webform..

Thanks,

Sinisa

<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Bus inessTest.aspx. vb" Inherits="EDMSe archForms.Busin essTest"
EnableSessionSt ate="True" enableViewState ="True"%>
<%@ Register TagPrefix="uc1" TagName="Busine ssDirectoryUC"
Src="../Forms/BusinessDirecto ryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Business Test</title>
<meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="search1" method="post" runat="server"
action="http://www.techtriangl e.com/search/SearchResultsWa terloo.cfm"
name="search">
<input type="hidden" name="SearchSco pe" value="Business ">
</form>
</body>
</HTML>


Nov 19 '05 #8
P.S. Turns out it was cleaner to build the whole "redirect" page strictly via
code in the helper class, e.g. "<html><body><f orm name= ...", etc., and
output the hidden fields as literal text in the middle.

"Bill Borg" wrote:
I'm trying to do something similar, to do a POST to paypal. In my quick
testing, I don't see that removing runat=server and using server controls are
mutually exclusive, it's just that you can't process any events from those
controls (which you don't care about, because you're off to another page
anyway).

In my test, I have a single placeholder on the form, and the <form> has
"runat=serv er" gone, method="post" and action="paypal, etc.". In the
code-behind I add htmlinputhidden fields to the placeholder for all my
name/value pairs (appears that I have to set id= for each, which sets both
name= and id=, not sure why).

When I submit this form it goes to paypal with the post values as planned.
Last piece I'm working on is to do the submit automatically, which per
various posts out here I think I can do as document.forms[0].submit().

hth,

Bill

"TheOne" wrote:
In Asp.net web form under form tag there is action field that I am point to
some other page, and not to same web form. When I run this page it is always
pointing to itself. How do I get around this?

Here is HTML code from webform..

Thanks,

Sinisa

<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Bus inessTest.aspx. vb" Inherits="EDMSe archForms.Busin essTest"
EnableSessionSt ate="True" enableViewState ="True"%>
<%@ Register TagPrefix="uc1" TagName="Busine ssDirectoryUC"
Src="../Forms/BusinessDirecto ryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Business Test</title>
<meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="search1" method="post" runat="server"
action="http://www.techtriangl e.com/search/SearchResultsWa terloo.cfm"
name="search">
<input type="hidden" name="SearchSco pe" value="Business ">
</form>
</body>
</HTML>

Nov 19 '05 #9
P.S. Turns out it was cleaner to build the entire "redirect" page from
scratch via code in the helper class, e.g. "<html><body><f orm name=...>",
etc. and write the hidden fields as literal text in the middle.

"Bill Borg" wrote:
I'm trying to do something similar, to do a POST to paypal. In my quick
testing, I don't see that removing runat=server and using server controls are
mutually exclusive, it's just that you can't process any events from those
controls (which you don't care about, because you're off to another page
anyway).

In my test, I have a single placeholder on the form, and the <form> has
"runat=serv er" gone, method="post" and action="paypal, etc.". In the
code-behind I add htmlinputhidden fields to the placeholder for all my
name/value pairs (appears that I have to set id= for each, which sets both
name= and id=, not sure why).

When I submit this form it goes to paypal with the post values as planned.
Last piece I'm working on is to do the submit automatically, which per
various posts out here I think I can do as document.forms[0].submit().

hth,

Bill

"TheOne" wrote:
In Asp.net web form under form tag there is action field that I am point to
some other page, and not to same web form. When I run this page it is always
pointing to itself. How do I get around this?

Here is HTML code from webform..

Thanks,

Sinisa

<%@ Page Language="vb" AutoEventWireup ="false"
Codebehind="Bus inessTest.aspx. vb" Inherits="EDMSe archForms.Busin essTest"
EnableSessionSt ate="True" enableViewState ="True"%>
<%@ Register TagPrefix="uc1" TagName="Busine ssDirectoryUC"
Src="../Forms/BusinessDirecto ryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Business Test</title>
<meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="search1" method="post" runat="server"
action="http://www.techtriangl e.com/search/SearchResultsWa terloo.cfm"
name="search">
<input type="hidden" name="SearchSco pe" value="Business ">
</form>
</body>
</HTML>

Nov 19 '05 #10

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

Similar topics

5
6078
by: Richard Cornford | last post by:
I am interested in hearing opinions on the semantic meaning of FORM (elements) in HTML. I have to start of apologising because this question arose in a context that is not applicable to the Internet. Specifically, marking up a document that will contain multiple related form controls (intended exclusively for client-side scripting) that...
3
1975
by: Michele | last post by:
Hi all, I have a form with 3 combobox whitin a asp page called data.asp, whose action form is itself; the first combobox drives the behaviour of the other two. The onchange event of the first combobox is related to a javascript function in which I call the submit method for the form, whose action form is itself. This works fine. The problem...
6
3089
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
5
8425
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
7
2354
by: David T. Ashley | last post by:
Hi, For a web page, I want a SUBMIT button that commits the form data and a CANCEL button that goes to a different target (i.e. a different script). I haven't figured out how to do this, because the <FORM ACTION="... tag seems to make sure that any two submit controls in a form have to go to the same target. BTW, the CANCEL button does...
10
14056
by: Steve Last | last post by:
Hi all, I’m using IIS6 for our college Intranet and I’m having trouble using Request.Form. Here is my code: <% If Request.QueryString("action") = "show" Then Response.Write "title: " & Request.Form("NewsTitle") & "<br />" End If %>
4
2378
SHOverine
by: SHOverine | last post by:
I have a 3-part form that I am having trouble with. First part is to select the user group and the week and year that I want to submit results for, this calls the elements that I want to update. The second part is to enter the results and submit them to a MySQL table called results the final part echoes the results. The issue is that my...
3
8000
by: kirke | last post by:
In php, is there any way to submit button(in a form) makes window pop-up? -INDEX.PHP : <form id="form1" name="form1" method="post" action="vehicle.php"> <input name="submit" type="submit" id="submit" value="submit" /> </form> This goes to only action page. (vehicle.php)
26
2786
by: Jerim79 | last post by:
I need to create a form that takes a number that the user enters, and duplicates a question the number of times the user entered. For instance, if the customer enters 5 on the first page, when they press next the form generates "How old are you?" 5 times on the page. The customer will answer all 5 questions then press next. Finally, all the...
12
6923
by: Daniel Klein | last post by:
I'm pretty new at php and web stuff so please be gentle with me. I'm trying to get a form to submit when the user presses the Enter key. I do not want to use javascript. I've googled this to death and cant find the answer (only hints), except on the 'Experts Exhange' page and you have to pay to get the answer :-( Why is this such a secret...
0
7882
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
8103
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...
1
7634
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...
0
7945
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6244
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...
0
3634
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...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2079
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
0
916
bsmnconsultancy
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...

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.