如何在母版页中使用? [英] How to use in master page?

查看:95
本文介绍了如何在母版页中使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

以下代码在单独的页面中工作正常.但是,如果我在具有母版页的页面中放置相同的代码,它将不会重定向到下一页.请提出任何建议.代码如下.



Following code is working fine in separate page. But if I put same code in page with master page it won''t redirect to next page. Any suggestion please. Code is as below.

<form method="post" action="https://www.Somewebsite.com">
	<input type="hidden" id="CustomerID" name="CustomerID" runat="server" value="1" />
	<input type="hidden" id="Amount" name="Amount" value="100.00" runat="server">
	<input type="hidden" id="InvoiceNO" name="InvoiceNO" runat="server" value="INV_001">
<input id="Submit1" type="submit" value="submit" runat="server">
</input></input></input></form> 

推荐答案

这不是使用母版页的方式.

您要使用的页面(基本上是母版页面)的一个子页面,该子页面已经定义了表单:您只需要提供包装如下的其他所有内容(例如):

That''s not how one would use a Master Page.

The page you''re trying to use is a sub-page (essentially) of the Master Page that already has the form defined: you simply need to supply everything else wrapped as follows (as an example):

<%@ Page AutoEventWireup="True" Codebehind="Default.aspx.cs" Inherits="NameSpace.Default" Language="C#" MasterPageFile="~/Site.Master" %>
<asp:Content ID="contentMain" ContentPlaceHolderID="cphMaster" runat="server">
<p>Insert page content...</p>
</asp:Content>



非常简单地,您将创建代码以从提交按钮的onclick重定向页面,该代码可以是背后的代码(通过使用asp:Button控件或javascript表单,或者通过您认为适合于您的过程的任何方式.

您上面包含的页面是独立的,不能在母版页中使用.



Quite simplistically you would create code to redirect your page from the onclick of the submit button, either in code behind (by using an asp:Button control or form javascript or by whatever means you feel is appropriate for your process.

The page you have included above is stand alone and is not designed to be used from within a Master Page.


这篇关于如何在母版页中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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