zoukankan      html  css  js  c++  java
  • MVC MvcApplication 中在.CS文件(CodeBehide)中找不到服务器控件的解决办法


    ----------------------------------------------------------------------


    为什么我在也面上放上了服务器控件,在behide的.CS文件里面是找不到这么个服务器控件的 ?

    注:是在MvcApplication里面的
     

    补充:
        <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="MvcApplication2.Views.Home.Index" %>

    解决办法:   

    There is an issue with the default file templates that you use to create view pages with the MVC project.  They unfortunately by default don't generate the .designer.cs/.vb files that are used by the code-behind to get intellisense for controls - which is why you are running into the issue you are seeing.

    The good news is that this is easy to fix.  Just select your file in the solution explorer, right click, and choose the "Convert to Web Application" context menu option.  This will generate the .designer file for you.  From that point on, all changes you make to the .aspx file will be reflected in the code behind, and you'll be able to databind declaratively using the <asp:repeater> control.

  • 相关阅读:
    QT4.8.7和VS2010环境搭建及使用
    SQL Server--获取磁盘空间使用情况
    SQL SERVER--DBA 常用到的一些脚本
    MySQL--REPLACE INTO与自增
    MySQL--更新自增列的潜在风险
    MySQL--Skip GTID CAP
    MySQL--MHA与GTID
    MySQL--自增列学习
    MySQL--MHA原理
    MySQL--BNL/ICP/MRR/BKA
  • 原文地址:https://www.cnblogs.com/QLeelulu/p/992660.html
Copyright © 2011-2022 走看看