在我的网站上实现了母版页,但现在表单不起作用
我刚刚使用母版页实现了我的网站。所以它加载相同的页眉和页脚 对于每一页, 现在我的表格不再起作用了。 尝试将
母版页:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="WebSite.master.cs" Inherits="WebSite.WebSite" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title><asp:ContentPlaceHolder ID="titleContent" runat="server" /></title>
<link href="Resources/css/styles.css" rel="stylesheet" type="text/css" />
<link href="Resources/css/jqModal.css" rel="stylesheet" type="text/css" />
<link href="Resources/css/boxy.css" rel="stylesheet" type="text/css" />
<link href="Resources/css/form.css" rel="stylesheet" type="text/css" />
<script src="Resources/js/swfobject.js" type="text/javascript" > </script>
<script src="Resources/js/jquery-1.3.2.min.js" type="text/javascript" > </script>
<script src="Resources/js/jqModal.js" type="text/javascript"> </script>
<script src="Resources/js/soundmanager.js" type="text/javascript" > </script>
<script src="Resources/js/JScriptFunctions.js" type="text/javascript" > </script>
<script src="Resources/js/jquery.boxy.js" type="text/javascript" ></script>
<script src="Resources/js/styled.js" type="text/javascript" ></script>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form name="aspnetForm" method="post" id="aspnetForm" runat="server">
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
<div id="wrapper">
<div id="animation">
<div id="ctl00_singleBannerHomePage_pnlFlashContent">
</div>
<script language="javascript" type="text/javascript">
generateBanner(980, 220, 'ctl00_singleBannerHomePage_pnlFlashContent', 'bannersingleBannerHomePage', 'http://www.WebSite.com//Resources//flash/topmenu.swf', '');
</script>
</div>
<div class="banner" style="text-align: center;">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="960" height="120"
id="logo_250x105" align="middle">
<param name="movie" value="Resources/flash/banner_960x120.swf">
<param name="quality" value="high">
<param name="play" value="true">
<param name="loop" value="true">
<param name="wmode" value="transparent">
<param name="scale" value="showall">
<param name="menu" value="true">
<param name="devicefont" value="false">
<param name="salign" value="">
<param name="allowScriptAccess" value="sameDomain">
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="Resources/flash/banner_960x120.swf"
width="960" height="120">
<param name="movie" value="/resources/flash/banner_960x120.swf">
<param name="quality" value="high">
<param name="play" value="true">
<param name="loop" value="true">
<param name="wmode" value="transparent">
<param name="scale" value="showall">
<param name="menu" value="true">
<param name="devicefont" value="false">
<param name="salign" value="">
<param name="allowScriptAccess" value="sameDomain">
<!--<![endif]-->
<a href="https://www.adobe.com/go/getflash">
<img src="Resources/get_flash_player.gif" alt="Get Adobe Flash player">
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
<asp:ContentPlaceHolder ID="Main" runat="server">
</asp:ContentPlaceHolder>
<div id="footer">
<div id="menu_footer">
<ul>
<li><a id="ctl01_lnkMenuOption" href="http://www.WebSite.com/">
Home</a></li>
<li class="separator">|</li>
<li><a id="ctl03_lnkMenuOption" href="http://www.WebSite.com/">
Login</a></li>
<li class="separator">|</li>
<li><a id="ctl05_lnkMenuOption" href="http://www.WebSite.com/register">
Free Register</a></li>
<li class="separator">|</li>
<li><a id="ctl07_lnkMenuOption" href="http://www.WebSite.com/how">
How Does it work</a></li>
<li class="separator">|</li>
<li><a id="ctl15_lnkMenuOption" href="http://www.WebSite.com/winners">
Winners List</a></li>
<li class="separator">|</li>
<li><a id="ctl17_lnkMenuOption" href="http://www.WebSite.com/myAccount">
Members</a></li>
<li class="separator">|</li>
<li><a id="ctl19_lnkMenuOption" href="http://www.WebSite.com/">
Site Map</a></li>
<li class="separator">|</li>
<li><a id="ctl21_lnkMenuOption" href="http://www.WebSite.com/contact">
Contact</a></li>
<li class="separator">|</li>
<li><a id="ctl23_lnkMenuOption" href="http://www.WebSite.com/terms">
Terms & Policy</a></li>
<li class="separator">|</li>
<li><a id="ctl25_lnkMenuOption" href="http://www.WebSite.com/about">
About</a></li>
</ul>
<ul>
<li><a href="http://www.WebSite.com/" target="_blank">Beta</a></li>
<li class="separator">|</li>
<li><a href="http://www.WebSite.com/" target="_blank">Beta</a></li>
<li class="separator">|</li>
<li><a href="http://www.WebSite.com/" target="_blank">Beta</a></li>
<li class="separator">|</li>
<li><a href="http://www.WebSite.com/" target="_blank">Beta</a></li>
<li class="separator">|</li>
<li><a href="http://www.WebSite.com/" target="_blank">Beta</a></li>
<li class="separator">|</li>
<li><a href="http://www.WebSite.com/" target="_blank">Beta</a></li>
<li class="separator">|</li>
<li>
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_facebook_like" addthis:url="http://www.facebook.com/pages/WebSite/187442987973985" ></a>
<a class="addthis_button_tweet" addthis:url="http://www.WebSite.com/" ></a>
<a class="addthis_counter addthis_pill_style" addthis:url="http://www.WebSite.com/" ></a>
</div>
<script type="text/javascript"> var addthis_config = { "data_track_clickback": true };</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=danpe"></script>
<!-- AddThis Button END -->
</li>
<li class="separator">|</li>
<li><a href="http://www.WebSite.com/" target="_blank">WebSite © 2011</a></li>
</ul>
</div>
</div>
<object type="application/x-shockwave-flash" id="flashAlert" name="flashAlert" data="Resources/flash/AlertPlayer.swf"
width="1" height="1">
</object>
</form>
<script type="text/javascript">
$(document).ready(function () {
$('#adscaptcha_facebook_like_holder').remove();
$('#adscaptcha_buttons_holder').remove();
$('#adscaptcha_r4').remove();
});
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-23547527-1']);
_gaq.push(['_setDomainName', '.WebSite.com']);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="Default" MasterPageFile="~/WebSite.Master" Title="" %>
<asp:Content ID="ContentTitle" ContentPlaceHolderID="titleContent" Runat="Server">
WebSite!
</asp:Content>
<asp:Content ID="ContentHead" ContentPlaceHolderID="head" Runat="Server">
<meta name="AUTHOR" content="WebSite.com">
<meta name="CLASSIFACTION" content="auction, auctions">
<meta name="RATING" content="GENERAL">
<meta name="DISTRIBUTION" content="GLOBAL">
<meta name="REVISIT" content="1 DAYS">
<meta name="ROBOTS" content="INDEX,FOLLOW">
<meta property="og:title" content="WebSite! - SecondLife Auctions" />
<meta property="og:site_name" content="WebSite" />
<meta property="og:image" content="hhttp://www.WebSite.com/Resources/images/logo.png" />
<meta property="og:url" content="http://www.WebSite.com/" />
<meta property="fb:admins" content="1277633739" />
<link rel="image_src" href="http://www.WebSite.com/Resources/images/logo.png" />
<link rel="SHORTCUT ICON" href="http://www.WebSite.com/WebSite.ico" />
<script type="text/javascript">
function alertMe(message) {
var options = $.extend({ title: "Information" }, options || {});
var dialog = new Boxy("<div><p>" + message + "<a href='#' onclick='Boxy.get(this).hide(); return false'>Close me!</a></p></div>", options);
allDialogs.push(dialog);
return false;
}
</script>
<script type="text/javascript">
var message = "Impossible Action";
function clickIE() { if (document.all) { return false; } }
function clickNS(e) {
if
(document.layers || (document.getElementById && !document.all)) {
if (e.which == 2 || e.which == 3) { return false; }
}
}
if (document.layers)
{ document.captureEvents(Event.MOUSEDOWN); document.onmousedown = clickNS; }
else { document.onmouseup = clickNS; document.oncontextmenu = clickIE; }
document.oncontextmenu = new Function("return false")
</script>
<style type="text/css" media="screen">
#ctl00_singleBannerHomePage_pnlFlashContent
{
visibility: hidden;
}
</style>
</asp:Content>
<asp:Content ID="ContentMain" ContentPlaceHolderID="Main" Runat="Server" >
<div id="content">
<div class="sign-in-home">
<div class="login-form-home">
<% Response.Write(LoginPanel()); %>
<input type="submit" name="cmdLogin" value="Login" id="cmdLogin" class="red-button" tabindex="3" runat="server" />
</div>
</div>
<div class="login-text-home"></div>
</div>
<div class="sort-by-home">
<% Response.Write(SortPanel()); %>
</div>
<% Response.Write(Auctions()); %>
<script type="text/javascript">
$(document).ready(function () {
startAuctionsServiceHomePage();
});
</script>
</asp:content>
default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Page_Load");
if (Request.Form["cmdLogin"] != null && Request.Form["cmdLogin"] != "")
{
Response.Write("cmdLogin");
}
}
问题在于 Respone.Write("cmdLogin");不显示,并且在我拥有母版页之前它曾经显示过。
I just implemented my website with a Master Page. so it loads the same header and same footer
for every page,
and now my forms doesn't work anymore.
tried to move the <form>
tag inside the master page and outside and still nothing.
Master Page:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="WebSite.master.cs" Inherits="WebSite.WebSite" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title><asp:ContentPlaceHolder ID="titleContent" runat="server" /></title>
<link href="Resources/css/styles.css" rel="stylesheet" type="text/css" />
<link href="Resources/css/jqModal.css" rel="stylesheet" type="text/css" />
<link href="Resources/css/boxy.css" rel="stylesheet" type="text/css" />
<link href="Resources/css/form.css" rel="stylesheet" type="text/css" />
<script src="Resources/js/swfobject.js" type="text/javascript" > </script>
<script src="Resources/js/jquery-1.3.2.min.js" type="text/javascript" > </script>
<script src="Resources/js/jqModal.js" type="text/javascript"> </script>
<script src="Resources/js/soundmanager.js" type="text/javascript" > </script>
<script src="Resources/js/JScriptFunctions.js" type="text/javascript" > </script>
<script src="Resources/js/jquery.boxy.js" type="text/javascript" ></script>
<script src="Resources/js/styled.js" type="text/javascript" ></script>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form name="aspnetForm" method="post" id="aspnetForm" runat="server">
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
<div id="wrapper">
<div id="animation">
<div id="ctl00_singleBannerHomePage_pnlFlashContent">
</div>
<script language="javascript" type="text/javascript">
generateBanner(980, 220, 'ctl00_singleBannerHomePage_pnlFlashContent', 'bannersingleBannerHomePage', 'http://www.WebSite.com//Resources//flash/topmenu.swf', '');
</script>
</div>
<div class="banner" style="text-align: center;">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="960" height="120"
id="logo_250x105" align="middle">
<param name="movie" value="Resources/flash/banner_960x120.swf">
<param name="quality" value="high">
<param name="play" value="true">
<param name="loop" value="true">
<param name="wmode" value="transparent">
<param name="scale" value="showall">
<param name="menu" value="true">
<param name="devicefont" value="false">
<param name="salign" value="">
<param name="allowScriptAccess" value="sameDomain">
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="Resources/flash/banner_960x120.swf"
width="960" height="120">
<param name="movie" value="/resources/flash/banner_960x120.swf">
<param name="quality" value="high">
<param name="play" value="true">
<param name="loop" value="true">
<param name="wmode" value="transparent">
<param name="scale" value="showall">
<param name="menu" value="true">
<param name="devicefont" value="false">
<param name="salign" value="">
<param name="allowScriptAccess" value="sameDomain">
<!--<![endif]-->
<a href="https://www.adobe.com/go/getflash">
<img src="Resources/get_flash_player.gif" alt="Get Adobe Flash player">
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
<asp:ContentPlaceHolder ID="Main" runat="server">
</asp:ContentPlaceHolder>
<div id="footer">
<div id="menu_footer">
<ul>
<li><a id="ctl01_lnkMenuOption" href="http://www.WebSite.com/">
Home</a></li>
<li class="separator">|</li>
<li><a id="ctl03_lnkMenuOption" href="http://www.WebSite.com/">
Login</a></li>
<li class="separator">|</li>
<li><a id="ctl05_lnkMenuOption" href="http://www.WebSite.com/register">
Free Register</a></li>
<li class="separator">|</li>
<li><a id="ctl07_lnkMenuOption" href="http://www.WebSite.com/how">
How Does it work</a></li>
<li class="separator">|</li>
<li><a id="ctl15_lnkMenuOption" href="http://www.WebSite.com/winners">
Winners List</a></li>
<li class="separator">|</li>
<li><a id="ctl17_lnkMenuOption" href="http://www.WebSite.com/myAccount">
Members</a></li>
<li class="separator">|</li>
<li><a id="ctl19_lnkMenuOption" href="http://www.WebSite.com/">
Site Map</a></li>
<li class="separator">|</li>
<li><a id="ctl21_lnkMenuOption" href="http://www.WebSite.com/contact">
Contact</a></li>
<li class="separator">|</li>
<li><a id="ctl23_lnkMenuOption" href="http://www.WebSite.com/terms">
Terms & Policy</a></li>
<li class="separator">|</li>
<li><a id="ctl25_lnkMenuOption" href="http://www.WebSite.com/about">
About</a></li>
</ul>
<ul>
<li><a href="http://www.WebSite.com/" target="_blank">Beta</a></li>
<li class="separator">|</li>
<li><a href="http://www.WebSite.com/" target="_blank">Beta</a></li>
<li class="separator">|</li>
<li><a href="http://www.WebSite.com/" target="_blank">Beta</a></li>
<li class="separator">|</li>
<li><a href="http://www.WebSite.com/" target="_blank">Beta</a></li>
<li class="separator">|</li>
<li><a href="http://www.WebSite.com/" target="_blank">Beta</a></li>
<li class="separator">|</li>
<li><a href="http://www.WebSite.com/" target="_blank">Beta</a></li>
<li class="separator">|</li>
<li>
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_facebook_like" addthis:url="http://www.facebook.com/pages/WebSite/187442987973985" ></a>
<a class="addthis_button_tweet" addthis:url="http://www.WebSite.com/" ></a>
<a class="addthis_counter addthis_pill_style" addthis:url="http://www.WebSite.com/" ></a>
</div>
<script type="text/javascript"> var addthis_config = { "data_track_clickback": true };</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=danpe"></script>
<!-- AddThis Button END -->
</li>
<li class="separator">|</li>
<li><a href="http://www.WebSite.com/" target="_blank">WebSite © 2011</a></li>
</ul>
</div>
</div>
<object type="application/x-shockwave-flash" id="flashAlert" name="flashAlert" data="Resources/flash/AlertPlayer.swf"
width="1" height="1">
</object>
</form>
<script type="text/javascript">
$(document).ready(function () {
$('#adscaptcha_facebook_like_holder').remove();
$('#adscaptcha_buttons_holder').remove();
$('#adscaptcha_r4').remove();
});
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-23547527-1']);
_gaq.push(['_setDomainName', '.WebSite.com']);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="Default" MasterPageFile="~/WebSite.Master" Title="" %>
<asp:Content ID="ContentTitle" ContentPlaceHolderID="titleContent" Runat="Server">
WebSite!
</asp:Content>
<asp:Content ID="ContentHead" ContentPlaceHolderID="head" Runat="Server">
<meta name="AUTHOR" content="WebSite.com">
<meta name="CLASSIFACTION" content="auction, auctions">
<meta name="RATING" content="GENERAL">
<meta name="DISTRIBUTION" content="GLOBAL">
<meta name="REVISIT" content="1 DAYS">
<meta name="ROBOTS" content="INDEX,FOLLOW">
<meta property="og:title" content="WebSite! - SecondLife Auctions" />
<meta property="og:site_name" content="WebSite" />
<meta property="og:image" content="hhttp://www.WebSite.com/Resources/images/logo.png" />
<meta property="og:url" content="http://www.WebSite.com/" />
<meta property="fb:admins" content="1277633739" />
<link rel="image_src" href="http://www.WebSite.com/Resources/images/logo.png" />
<link rel="SHORTCUT ICON" href="http://www.WebSite.com/WebSite.ico" />
<script type="text/javascript">
function alertMe(message) {
var options = $.extend({ title: "Information" }, options || {});
var dialog = new Boxy("<div><p>" + message + "<a href='#' onclick='Boxy.get(this).hide(); return false'>Close me!</a></p></div>", options);
allDialogs.push(dialog);
return false;
}
</script>
<script type="text/javascript">
var message = "Impossible Action";
function clickIE() { if (document.all) { return false; } }
function clickNS(e) {
if
(document.layers || (document.getElementById && !document.all)) {
if (e.which == 2 || e.which == 3) { return false; }
}
}
if (document.layers)
{ document.captureEvents(Event.MOUSEDOWN); document.onmousedown = clickNS; }
else { document.onmouseup = clickNS; document.oncontextmenu = clickIE; }
document.oncontextmenu = new Function("return false")
</script>
<style type="text/css" media="screen">
#ctl00_singleBannerHomePage_pnlFlashContent
{
visibility: hidden;
}
</style>
</asp:Content>
<asp:Content ID="ContentMain" ContentPlaceHolderID="Main" Runat="Server" >
<div id="content">
<div class="sign-in-home">
<div class="login-form-home">
<% Response.Write(LoginPanel()); %>
<input type="submit" name="cmdLogin" value="Login" id="cmdLogin" class="red-button" tabindex="3" runat="server" />
</div>
</div>
<div class="login-text-home"></div>
</div>
<div class="sort-by-home">
<% Response.Write(SortPanel()); %>
</div>
<% Response.Write(Auctions()); %>
<script type="text/javascript">
$(document).ready(function () {
startAuctionsServiceHomePage();
});
</script>
</asp:content>
default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Page_Load");
if (Request.Form["cmdLogin"] != null && Request.Form["cmdLogin"] != "")
{
Response.Write("cmdLogin");
}
}
The problem is that the Respone.Write("cmdLogin"); doesn't show up, and it used to show up before i had the Master Page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
即使您使用母版页,您仍然只能从中得到一个标记。因此,请这样看:
母版页:
WebForm:
输出标记
要点是,如果您在两者中都使用表单,则如果您在两者中都有表单,则可以预期嵌套表单会出现在最终标记上。这只是它的外观的轮廓。如果您发布页面,我们可以为您提供更适当的帮助。
编辑
利用 C# 中可用的 OOP - 创建一个 Button 对象并将其附加到页面。您将始终以这种方式引用它。避免在 asp.Net 中写入响应
Even when you are using a master page, you still only get one markup coming out of it. So look at it this way:
Master Page:
WebForm:
output Markup
The point is that if you use a form in both, you can expect to have nested forms appear on the final markup if you have forms in both. This is just an outline of what it can look like. If you post your pages we can give you more appropriate assistance.
Edit
Take advantage of the OOP available in C# - Create a Button object and append it to the page. You will always have a reference to it that way. Avoid writing to the response in asp.Net
@Danpe - 您是否查看过在单击 cmdLogin 按钮之前呈现的页面源代码?您是否在 page_load 中放置了一个断点来查看 Request.Form["cmdLogin"] 的值是什么?
除非您使用 Framework 4 和静态控件 ID 机制,否则 cmdLogin 按钮的 ID/名称实际上不会是“cmdLogin”,而是经过修改的名称,以确保 ID 不会与页面中的其他控件冲突。我相信,自 ASP.Net 诞生以来,这一直是标准行为。
由于 cmdLogin 是服务器端控件,因此在代码隐藏中添加按钮单击事件处理程序实际上会更好,而不是尝试手动解析表单参数。您似乎正在与 Web Forms 提供的功能作斗争。
@Danpe - have you taken a look at the page source that is rendered before you click the cmdLogin button? Have you placed a break point in the page_load to see what the value of Request.Form["cmdLogin"] is?
Unless you are using Framework 4 and static control ID mechanism, the ID/name of the cmdLogin button will not actually be "cmdLogin", but rather a modified name to ensure that ID does not conflict with other controls in the page. This has been standard behavior of ASP.Net since its inception, I believe.
Since cmdLogin is a server-side control, you would actually be better served by adding a button click event handler in the codebehind, rather than trying to manually parse the form parameters. You seem to be fighting with the features that Web Forms provides.
将此:更改
为:
,然后在 .cs 文件中,您可以通过以下方式访问该按钮:
编辑
将其添加到 asp:Button 标记
或
将其添加到 .cs文件:
Change this:
to this:
and then in the .cs file you can access the button by:
Edit
add this to the asp:Button tag
OR
add this to the .cs file:
将表单声明移至母版页,如下所示:
Move your form declaration to the master page, something like:
尝试从母版页中删除此块:
Try removing this block from the master page: