我目前正在使用Visual Studio 2019,我正在使用asp Link Buttons,当您通常双击onclick时,VS将打开已定义事件的.cs页面。 我无法做到这一点,有人遇到过这个问题吗?
<asp:LinkButton class="ftr" ID="LoginBtn" runat="server" onClick ="LoginBtn" Visible="True">Login</asp:LinkButton>
当动态控件在双击时停止在文件中生成事件时.cs原因有很多。其中一个主要内容是请查看您的页面指令,正确指向CodeBehind文件及其继承位置。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="projectname.index" %>
在上面的代码中,索引是页面名称,索引.aspx.cs是文件背后的代码,所以我的 cs 文件看起来像:
namespace projectname
{
public partial class index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}