简体   繁体   English

内容页面和母版页事件

[英]Content Page and Master Page events

I have had this problem for a while now and no matter what i cannot seem to resolve it. 我有这个问题已经有一段时间了,无论我似乎无法解决它。 I have a master page and a content page. 我有一个母版页和一个内容页。

The content page simply contains a button 内容页面仅包含一个按钮

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</asp:Content>

The master page simply contains the content place holders. 母版页仅包含内容占位符。 The button1 one event fires normally, however as soon as a form is added to the master page the button stops firing. button1一个事件正常触发,但是将表单添加到母版页后,该按钮立即停止触发。 the master page looks something like this 母版页看起来像这样

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

Member Login 会员登录

                    <asp:Button ID="btnLogin" runat="server" Text="Login" CssClass="bt_login" 
                        onclick="btnLogin_Click" />
                    </form>
                </div>
            </div>
        </div>
    </div>

<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>

</form>

Can some one please help, the button works fine without the form in teh master page, however i need a form in the master page 有人可以帮忙吗,该按钮可以在没有主页的表单的情况下正常工作,但是我需要在主页中有表单

Thanks 谢谢

Ok after running the exact same project on another machine, everything worked fine. 在另一台机器上运行完全相同的项目后,一切正常。 So I'm guessing there is an issue with the way i installed visual studio and asp.net. 因此,我猜测我安装Visual Studio和asp.net的方式存在问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM