asp.net - 单击时asp LinkButton不会产生代码
问题描述
我目前正在使用 Visual Studio 2019,我正在使用 asp 链接按钮,当您通常双击 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" %>
在上面的代码中index是页面名称,index.aspx.cs是代码隐藏文件,所以我的 cs 文件看起来像:
namespace projectname
{
public partial class index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
推荐阅读
- java - 如何在android上设置相机方向锁定为纵向
- laravel - 如何使用cropperjs修复CORS策略?
- repository - 仅从测试存储库 apt-install 特定软件包
- flask - 带有 mongoengine 的 APScheduler 在作业中传递旧值
- ms-access - PowerPivot 连接多个带有日期的表的问题
- arrays - Bash Mapfile 或在 grep 文件内容时读取
- javascript - 如何将行添加到第一个空行?带有 chrome 扩展的 Google 电子表格 API
- angular - 执行可信脚本
- security - Odoo 安全,防止登录用户使用 jsonrpc 访问未受保护的表?
- ffmpeg - 我可以从视频中提取音频剪辑(一个单词)并使用 FFMPEG/libvlcsharp 在同一视频的不同点/时间线上插入吗?