12 |
13 |
Getting started
14 |
15 | ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
16 | enables a clean separation of concerns and gives you full control over markup
17 | for enjoyable, agile development.
18 |
19 |
Learn more »
20 |
21 |
22 |
Get more libraries
23 |
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.
24 |
Learn more »
25 |
26 |
27 |
Web Hosting
28 |
You can easily find a web hosting company that offers the right mix of features and price for your applications.
29 |
Learn more »
30 |
31 |
--------------------------------------------------------------------------------
/Simple_Sample/BlogSample/Scripts/project.extends.js:
--------------------------------------------------------------------------------
1 | //可在Javascript中使用如同C#中的string.format
2 | //使用方式 : var fullName = String.format('Hello. My name is {0} {1}.', 'Kevin', 'Tseng');
3 | //Kevin
4 | //2011.07.07
5 | String.format = function () {
6 | var s = arguments[0];
7 | if (s == null) return "";
8 |
9 | for (var i = 0; i < arguments.length - 1; i++) {
10 | var reg = getStringFormatPlaceHolderRegEx(i);
11 | s = s.replace(reg, (arguments[i + 1] == null ? "" : arguments[i + 1]));
12 | }
13 | return cleanStringFormatResult(s);
14 | };
15 |
16 | //可在Javascript中使用如同C#中的string.format (對jQuery String的擴充方法)
17 | //使用方式 : var fullName = 'Hello. My name is {0} {1}.'.format('Kevin', 'Tseng');
18 | //Kevin
19 | //2011.07.07
20 | String.prototype.format = function () {
21 | var txt = this.toString();
22 | for (var i = 0; i < arguments.length; i++) {
23 | var exp = getStringFormatPlaceHolderRegEx(i);
24 | txt = txt.replace(exp, (arguments[i] == null ? "" : arguments[i]));
25 | }
26 | return cleanStringFormatResult(txt);
27 | };
28 |
29 | //讓輸入的字串可以包含{}
30 | //Kevin
31 | //2011.07.07
32 | getStringFormatPlaceHolderRegEx = function (placeHolderIndex) {
33 | return new RegExp('({)?\\{' + placeHolderIndex + '\\}(?!})', 'gm');
34 | };
35 |
36 | //當format格式有多餘的position時,就不會將多餘的position輸出
37 | //ex:
38 | // var fullName = 'Hello. My name is {0} {1} {2}.'.format('firstName', 'lastName');
39 | // 輸出的 fullName 為 'firstName lastName', 而不會是 'firstName lastName {2}'
40 | //Kevin
41 | //2011.07.07
42 | cleanStringFormatResult = function (txt) {
43 | if (txt == null) return "";
44 | return txt.replace(getStringFormatPlaceHolderRegEx("\\d+"), "");
45 | };
46 |
--------------------------------------------------------------------------------
/Simple_Sample/BlogSample/Views/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
32 | @RenderBody()
33 |
34 |
37 |
38 |
39 | @Scripts.Render("~/bundles/jquery")
40 | @Scripts.Render("~/bundles/bootstrap")
41 | @RenderSection("scripts", required: false)
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Simple_Sample/BlogSample/Views/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |