Asp.net表单提交动作问题 [英] Asp.net form submit action question

查看:55
本文介绍了Asp.net表单提交动作问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在表单标签下的Asp.net网页表单中,有一个操作字段,我指向

其他页面,而不是相同的网页表单。当我运行这个页面时,它始终是

指向自己。我如何解决这个问题?


这是来自webform的HTML代码..


谢谢,


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 ="搜索1"方法= QUOT;交" runat =" server"

action =" http://www.techtriangle.com/search/SearchResultsWaterloo.cfm"

name =" search">

< input type =" hidden"名称= QUOT; SearchScope的" value =" Business">

< / form>

< / body>

< / HTML>

解决方案

使用< form runat ="服务器">你*不能有行动的价值。所有

aspx表单必须回发到同一页面。如果您删除runat =" server"

,您可以执行此操作;但你坚持使用html控件


TheOne写道:

在表单标签下的Asp.net网页表单中,有一个动作字段,我指向其他页面,而不是同一个网页表单。当我运行这个页面时,它总是指向自己。我如何解决这个问题?

这是来自webform的HTML代码..

谢谢,

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"方法= QUOT;交" runat =" server"
action =" http://www.techtriangle.com/search/SearchResultsWaterloo.cfm"
name =" search">
<输入类型= QUOT;隐藏"名称= QUOT; SearchScope的" value =" Business">
< / form>
< / body>
< / HTML>



你必须删除表单的runat = server。一个ASP.Net表格必须

回复自己来处理某些类型的事件,比如在服务器上点击

按钮'。


希望这会有所帮助,

Mark Fitzpatrick

Microsoft MVP - FrontPage


TheOne <钍**** @ noemail.nospam>写在消息

新闻:呃************** @ TK2MSFTNGP12.phx.gbl ...

在Asp.net网站在表单标签下有一个动作字段,我指的是
到其他一些页面,而不是同一个网页表单。当我运行这个页面时,它总是指向自己。我如何解决这个问题?

这是来自webform的HTML代码..

谢谢,

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"方法= QUOT;交" runat =" server"
action =" http://www.techtriangle.com/search/SearchResultsWaterloo.cfm"
name =" search">
<输入类型= QUOT;隐藏"名称= QUOT; SearchScope的" value =" Business">
< / form>
< / body>
< / HTML>



我必须使用服务器控件,因为我将使用用户控制

它。是否可以使用response.redirect提交表单?是否有一些

其他解决方案。不知怎的,我需要从这个表格发布信息。


谢谢,


Sinisa


" ; TheOne" <钍**** @ noemail.nospam>写在消息

新闻:呃************** @ TK2MSFTNGP12.phx.gbl ...

在Asp.net网站在表单标签下有一个动作字段,我指向其他页面的
,而不是同一个网页表单。当我运行这个页面时,
总是指向自己。我如何解决这个问题?

这是来自webform的HTML代码..

谢谢,

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"方法= QUOT;交" runat =" server"
action =" http://www.techtriangle.com/search/SearchResultsWaterloo.cfm"
name =" search">
<输入类型= QUOT;隐藏"名称= QUOT; SearchScope的" value =" Business">
< / form>
< / body>
< / HTML>



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>

解决方案

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>



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>



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>



这篇关于Asp.net表单提交动作问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆