首页 新闻 会员 周边 捐助

问一个关于 MVC Application 的问题

0
[已解决问题] 解决于 2007-12-12 23:06
<IMG height=311 alt="" src="http://www.cnblogs.com/images/cnblogs_com/qleelulu/1111.jpg" width=472 border=0><BR>----------------------------------------------------------------------<BR><IMG alt="" src="http://www.cnblogs.com/images/cnblogs_com/qleelulu/2222.jpg" border=0><BR><BR><SPAN style="COLOR: red">为什么我在也面上放上了服务器控件,在beside的.CS文件里面是找不到这么个服务器控件的 ?</SPAN><BR><BR>注:是在<FONT face="Courier New">MvcApplication里面的<BR><IMG height=138 alt="" src="http://www.cnblogs.com/images/cnblogs_com/qleelulu/333.jpg" width=465 border=0></FONT>&nbsp;
问题补充: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="MvcApplication2.Views.Home.Index" %> 问题出在CodeBehind这里,将"CodeBehind"改成"CodeFile"就OK了,为什么CodeBehind就不可以呢?在MVCMvcApplication里面为什么要用CodeBehind呢 ?
Q.Lee.lulu的主页 Q.Lee.lulu | 小虾三级 | 园豆:565
提问于:2007-12-12 20:36
< >
分享
最佳答案
0
引用在ScottGu评论中找到的: "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."
MK2 | 菜鸟二级 |园豆:250 | 2007-12-12 23:00
其他回答(2)
0
有可能是在08里面需要点时间才能够出来 我实验过,刚拖了控件 马上在cs中写代码,智能提示会出不来,等一下就可以了
oec2003 | 园豆:945 (小虾三级) | 2007-12-12 21:12
0
保存一下, 最好ctrl+shift+B一下 后就出来了 CodeBehind针对Application CodeFile针对WebSite
代码闪亮 | 园豆:100 (初学一级) | 2007-12-12 22:08
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册