点击事件处理程序不打开code窗口 [英] Clicking on Events handler does not open the code window

查看:174
本文介绍了点击事件处理程序不打开code窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里,我面临着一个奇怪的问题。我有两个项目,他们每个人都有某些网页。
起初,我并没有试图创建用户帐户和登录。不过,我只是想能够在其工作罚款按钮单击事件启动一个进程。

I am facing a strange problem here. I have two projects, each of them has some webpages. Initially i did not attempt User Account Creation and Login. However i just wanted to be able to start a process on a Button Click Event which worked fine.

但是,在我的新项目[我在那里使用的用户登录],我只是我不能创造任何处理,这是我的code代表它不工作的页面:

However in my new project [where i have used User Login], i simply am not able to create any handlers, here is my code for the page its not working:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site1.master" AutoEventWireup="true"
    CodeBehind="~/Default.aspx.cs" Inherits="Default" %>


<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <style type="text/css">
        .style1
        {
            width: 100%;
            background-image: url('../Images/dl.jpg');
        }
    </style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent" >
    <h1>
        <span class="input">Welcome to the members-only page.</span>
    </h1>
    <h2>
        Start Client Side Application.
    </h2>
            <asp:LoginView ID="LoginView1" runat="server">
                <AnonymousTemplate>
                    <span class="input">&nbsp;You are not logged in. Click the Login link to sign in</span>
                </AnonymousTemplate>
                <LoggedInTemplate>
                    <span class="input">You are logged in. Welcome, </span>
                </LoggedInTemplate>
            </asp:LoginView>
            <asp:LoginName ID="LoginName1" runat="server" />
            &nbsp;&nbsp;

            <table class="style1">
                <tr>
                    <td align="center" valign="middle">
            <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        Click on This Image Link To Start The Application<br />
                        <br />
                        <asp:ImageButton runat="server" ID="ImageButton1" Height="100px" 
                            ImageUrl="~/Images/rdi.jpg" />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                    </td>
                </tr>
            </table>
            <asp:LoginStatus ID="LoginStatus1" runat="server" 
                LogoutAction="RedirectToLoginPage" BackColor="White" 
                Font-Underline="True" />

</asp:Content>

,这是什么解决办法?事实上,我只注意到事件处理程序在同一个项目中的另一个网页,但没有这一项工作。

What is the workaround for this? In fact i just noticed that the event handlers work for another webpage within the same project but not this one.

推荐答案

有时(虽然很少)自动生成的aspx.designer.cs文件会导致在code-背后奇怪的问题。你看这个文件,看看是否控制包括符合您定义的页面控件?

Sometimes (although rarely) the auto-generated "aspx.designer.cs" file can cause strange issues in the code-behind. Have you looked at this file to see if the controls included match your page defined controls?

如果您认为这可能是您可以删除和重新设计文件的问题。如果你以前从来没有删除的文件的设计师,这可能是一个有点可怕,但设计师文件是自动生成的,并在aspx.cs code隐藏文件中的部分类合并。基本上,这个文件被用于自动生成用于网页上的器WebControls的定义。

If you think this could be the issue you can delete and recreate the designer file. If you've never deleted a designer file before, this might be a bit frightening, but the designer file is auto-generated and merged with the partial class in the aspx.cs code-behind file. Basically, this file is used to auto-generate the definition for the WebControls on the page.

下面是一个链接,我很快找到搜索时:的http://www.undermyhat.org/blog/2009/07/tip-regenerate-aspx-designer-cs-files-when-corrupted/

Here's a link i found quickly when searching: http://www.undermyhat.org/blog/2009/07/tip-regenerate-aspx-designer-cs-files-when-corrupted/

要删除并重新创建Default.aspx.designer.cs:

To delete and recreate the Default.aspx.designer.cs:


  1. 右键单击设计文件,并选择删除

  2. 右键单击ASPX页面(Default.aspx的,你的情况),然后选择转换为Web应用程序菜单项。

这篇关于点击事件处理程序不打开code窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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