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

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="BusinessTest.aspx.vb" Inherits="EDMSearchForms.BusinessTest"
EnableSessionState="True" enableViewState="True"%>
<%@ Register TagPrefix="uc1" TagName="BusinessDirectoryUC"
Src="../Forms/BusinessDirectoryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>BusinessTest</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="search1" method="post" runat="server"
action="http://www.techtriangle.com/search/SearchResultsWaterloo.cfm"
name="search">
<input type="hidden" name="SearchScope" value="Business">
</form>
</body>
</HTML>
Nov 19 '05 #1
12 3418
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="BusinessTest.aspx.vb" Inherits="EDMSearchForms.BusinessTest"
EnableSessionState="True" enableViewState="True"%>
<%@ Register TagPrefix="uc1" TagName="BusinessDirectoryUC"
Src="../Forms/BusinessDirectoryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>BusinessTest</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="search1" method="post" runat="server"
action="http://www.techtriangle.com/search/SearchResultsWaterloo.cfm"
name="search">
<input type="hidden" name="SearchScope" 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**************@TK2MSFTNGP12.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="BusinessTest.aspx.vb" Inherits="EDMSearchForms.BusinessTest"
EnableSessionState="True" enableViewState="True"%>
<%@ Register TagPrefix="uc1" TagName="BusinessDirectoryUC"
Src="../Forms/BusinessDirectoryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>BusinessTest</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="search1" method="post" runat="server"
action="http://www.techtriangle.com/search/SearchResultsWaterloo.cfm"
name="search">
<input type="hidden" name="SearchScope" 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.redirect 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**************@TK2MSFTNGP12.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="BusinessTest.aspx.vb" Inherits="EDMSearchForms.BusinessTest"
EnableSessionState="True" enableViewState="True"%>
<%@ Register TagPrefix="uc1" TagName="BusinessDirectoryUC"
Src="../Forms/BusinessDirectoryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>BusinessTest</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="search1" method="post" runat="server"
action="http://www.techtriangle.com/search/SearchResultsWaterloo.cfm"
name="search">
<input type="hidden" name="SearchScope" 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.redirect 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**************@TK2MSFTNGP12.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="BusinessTest.aspx.vb" Inherits="EDMSearchForms.BusinessTest"
EnableSessionState="True" enableViewState="True"%>
<%@ Register TagPrefix="uc1" TagName="BusinessDirectoryUC"
Src="../Forms/BusinessDirectoryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>BusinessTest</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="search1" method="post" runat="server"
action="http://www.techtriangle.com/search/SearchResultsWaterloo.cfm"
name="search">
<input type="hidden" name="SearchScope" value="Business">
</form>
</body>
</HTML>


Nov 19 '05 #5
"TheOne" <Th****@noemail.nospam> wrote in message
news:uh**************@TK2MSFTNGP12.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.Redirect
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=server" 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="BusinessTest.aspx.vb" Inherits="EDMSearchForms.BusinessTest"
EnableSessionState="True" enableViewState="True"%>
<%@ Register TagPrefix="uc1" TagName="BusinessDirectoryUC"
Src="../Forms/BusinessDirectoryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>BusinessTest</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="search1" method="post" runat="server"
action="http://www.techtriangle.com/search/SearchResultsWaterloo.cfm"
name="search">
<input type="hidden" name="SearchScope" value="Business">
</form>
</body>
</HTML>

Nov 19 '05 #7
What is the "proper" way to programmatically 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
ContextItemRetentionBlock that renders hidden inputs with those values to
the page so that they don't get lost with the context.

"Mark Fitzpatrick" <ma******@fitzme.com> wrote in message
news:uW**************@TK2MSFTNGP09.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**************@TK2MSFTNGP12.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="BusinessTest.aspx.vb" Inherits="EDMSearchForms.BusinessTest"
EnableSessionState="True" enableViewState="True"%>
<%@ Register TagPrefix="uc1" TagName="BusinessDirectoryUC"
Src="../Forms/BusinessDirectoryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>BusinessTest</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="search1" method="post" runat="server"
action="http://www.techtriangle.com/search/SearchResultsWaterloo.cfm"
name="search">
<input type="hidden" name="SearchScope" 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><form 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=server" 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="BusinessTest.aspx.vb" Inherits="EDMSearchForms.BusinessTest"
EnableSessionState="True" enableViewState="True"%>
<%@ Register TagPrefix="uc1" TagName="BusinessDirectoryUC"
Src="../Forms/BusinessDirectoryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>BusinessTest</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="search1" method="post" runat="server"
action="http://www.techtriangle.com/search/SearchResultsWaterloo.cfm"
name="search">
<input type="hidden" name="SearchScope" 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><form 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=server" 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="BusinessTest.aspx.vb" Inherits="EDMSearchForms.BusinessTest"
EnableSessionState="True" enableViewState="True"%>
<%@ Register TagPrefix="uc1" TagName="BusinessDirectoryUC"
Src="../Forms/BusinessDirectoryUC.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>BusinessTest</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="search1" method="post" runat="server"
action="http://www.techtriangle.com/search/SearchResultsWaterloo.cfm"
name="search">
<input type="hidden" name="SearchScope" value="Business">
</form>
</body>
</HTML>

Nov 19 '05 #10
Hi Sinisa,

Yes, currently the ASP.NET 1.x hasn't any buildin means for cross-page
posting. If you do need to cross-post to different page, you can have a
look at the following article which mentioned the scripting way:

#Post an ASP.NET form with JavaScript
http://www.codeproject.com/aspnet/jsnopostback.asp

Also, the ASP.NET2.0 does provide complete and great support on cross-page
posting. And provide more features on the cross-page interaction Model.

Thanks.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #11
Hi, thanks this is what I am trying to do. Page that I am posting to is made
in cold fusion. Our web designer gave me java script to use to change
"action".

Thanks,

Sinisa

code.....

<script language="javascript" type="text/javascript">
//<!--

document.search1.action =
'http://www.techtriangle.com/search/SearchResultsWaterloo.cfm';

//-->
</script>

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:sp**************@TK2MSFTNGXA01.phx.gbl...
Hi Sinisa,

Yes, currently the ASP.NET 1.x hasn't any buildin means for cross-page
posting. If you do need to cross-post to different page, you can have a
look at the following article which mentioned the scripting way:

#Post an ASP.NET form with JavaScript
http://www.codeproject.com/aspnet/jsnopostback.asp

Also, the ASP.NET2.0 does provide complete and great support on cross-page
posting. And provide more features on the cross-page interaction Model.

Thanks.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #12
Thanks for your followup.

Glad that you've also found the tricks :)

Good LUck!

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #13

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

Similar topics

5
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...
3
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...
6
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...
5
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'...
7
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,...
10
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: " &...
4
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. ...
3
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"...
26
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...
12
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...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
0
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,...
0
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...

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.