如何在MVC中编写标准项目代码 [英] How can I code a standard project in MVC

查看:89
本文介绍了如何在MVC中编写标准项目代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

1)如何在MVC中编写标准项目?

2)我应该将.html文件用作UI或.aspx吗?

3)我可以在.aspx中同时使用html标签和asp控件吗?

4)我可以在MVC中使用JavaScript和Json吗?如果是,我应该将JSON值传递给Controllers或.aspx.cs文件吗?

5)使用混合的.js& .aspx&控制器标准?

提前致谢



我尝试过:



我试图在网上搜索并阅读一些文章,例如:

7天的MVC 或其他一些,但我真的很困惑,使用ASP.NET,MVC,Web API等技术。

Hello
1) How can I Code a standard project in MVC ?
2) shall I use .html files as UI or .aspx ?
3) can I use both html tags and asp controls in .aspx ?
4) can I use JavaScript and Json in MVC ? if Yes, shall I pass JSON values to Controllers or .aspx.cs Files ?
5) Is using a mixed of .js & .aspx & Controllers standard ?
Thanks in Advance

What I have tried:

I have tried to search on the web and reading some articles such as :
MVC in 7 Days or some others, but I am really Confused using technologies such as ASP.NET, MVC, Web API.

推荐答案

我会说你很困惑,很糟糕。从 ASP.NET MVC 5入门开始ASP.NET站点 [ ^ ]。



如果不清楚任何事情,我建议拿起一本关于MVC的书并完成它。您在网上找到的其他所有内容都将遵循与上述链接相同的内容。



1)无法回答这个问题。它本质上是在询问我如何编写代码。

2)MVC使用模板文件使用视图引擎为浏览器生成HTML。目前可以是Razor,Spark,NHaml或ASPX。您还可以提供自己的视图引擎实现。 Razor强烈推荐。不要混合模板页面类型。例如,不要在同一个项目中使用.CSHTL和.ASPX页面。选择一个视图和引擎并在整个项目中坚持使用它。

3)这个问题毫无意义。

4)是的。是的,您可以将Json格式的对象传递给MVC控制器方法。

5)是。
I'd say you're confused, badly. Start with Getting Started with ASP.NET MVC 5 | The ASP.NET Site[^] .

If that doesn't clear anything up, I suggest picking up a book on MVC and working through it. Everything else you find on the web is going to follow the same stuff as the above link.

1) Not possible to answer this. It's essentially asking "how do I write code".
2) MVC uses template files to generate HTML for the browser using a view engine. That can be either Razor, Spark, NHaml or ASPX currently. You can also provide your own view engine implementation. Razor is HIGHLY recommended. DO NOT mix template page types. For example, do NOT use .CSHTL and .ASPX pages in the same project. Pick one view and engine and stick with it throughout the project.
3) This question is meaningless.
4) Yes. Yes you can pass Json formatted objects to MVC Controller methods.
5) Yes.


这篇关于如何在MVC中编写标准项目代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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