Bài đăng

[MVC5 Series - P1] Giới thiệu về ASP.NET MVC 5 Nguồn Phan Tien Quang's Blogspot

Hình ảnh
Giới thiệu MVC không phải là một mô hình lập trình mới lạ gì, và thậm chí, nó còn ra đời từ rất sớm. Có thể nói ASP.NET MVC là mô hình lập trình web chiến lược của Microsoft. Do đó, đối với những ai yêu mến và đi theo .NET, phát triển ứng dụng web với ASP.NET MVC sẽ là một kỹ năng không thể thiếu được. Mình sẽ cố gắng xây dựng một chuỗi bài "hướng dẫn cơ bản" về ASP.NET MVC5 (và từ giờ sẽ nói ngắn gọn là MVC5 vì mình chỉ chơi với .NET). Mục tiêu của chuỗi bài này là để hướng dẫn, tham khảo và chia sẻ các kiến thức liên quan đến MVC5 dành cho tất cả mọi người, và cố gắng viết theo ngôn ngữ "bình dân" nhất để những ai mới làm quen không bị bỡ ngỡ. Và điều quan trọng, đi kèm với những bài giới thiệu và các ví dụ demo để các bạn hiểu rõ hơn vấn đề. Cài đặt chương trình Visual Studio 2013 (phiên bản mình đang dùng) hoặc Visual Studio 2013 Express for Web (nhẹ + miễn phí). Sở dĩ cần cài đặt VS 2013 là vì nó tạo project MVC5, còn VS 2010 + 2012 là MVC4 (hình như thế, muố

Lỗi không attach được Database vào SQL server 2008

Sau mấy lần sao chép file mdf từ máy cơ quan về nhà và ngược lại thỉnh thoảng lại bị lỗi không attach được vào SQL server 2008 với những thông báo lỗi đại loại như " An exception occurred while executing a Transact-SQL statement or batch". Copy file Database cần attach vào đúng thư mục có cấu trúc như ở máy cơ quan thì cũng có lúc được, cũng có lúc không, xét về nguyên tắc thì việc làm trên là vô lý nhưng sự thực là cũng có lúc nó được. Cuối cùng tìm kiếm trên internet thì có người bày cho cách xử lý như sau: - Phân lại quyền truy cập trên hệ thống cho file .mdf và file .ldf + Chuột phải vào file .mdf chọn Properties chọn sang thẻ Security + Click chọn  Edit  tiếp theo chọn  Add  => click  Advanced...  => click  Find Now  =>tìm đến tài khoản  EveryOne  rồi click OK => click tiếp Ok sau đó click vào tài khoản  EveryOne  vừa  Add  nhìn xuống dưới click chọn vào  Full Control  => click  Ok  và Ok  + Làm tương tự cho file .ldf - Vào trong SQL server attac

Cấu hình webconfig MVC đưa lên host

<?xml version="1.0" encoding="utf-8"?> <!--   For more information on how to configure your ASP.NET application, please visit   http://go.microsoft.com/fwlink/?LinkId=301880   --> <configuration>   <configSections>     <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->     <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net" />     <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />     <section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />   </configSections>   <connectionStrings>     <add name="ABCEntit

TRANG THAM KHẢO: http://nice-tutorials.blogspot.com/

Trang web tham khảo:  http://nice-tutorials.blogspot.com/

Limit the Number of Characters in a Textarea or Text Field

THAM KHẢO TRÊN:  http://www.mediacollege.com/internet/javascript/form/limit-characters.html This script allows you to set a limit on the number of characters a user can enter into a textarea or text field, like so: (Maximum characters: 100) You have   characters left. Step 1 - Create Function Insert the following code into the page head: <script language="javascript" type="text/javascript"> function limitText(limitField, limitCount, limitNum) { if (limitField.value.length > limitNum) { limitField.value = limitField.value.substring(0, limitNum); } else { limitCount.value = limitNum - limitField.value.length; } } </script> Step 2 - Create Text Area Use the following code to create the form and text area (if necessary, change the name of the form and text area to suit your needs): <form name="myform"> <textarea name="limitedtextarea" onKeyDown="limitText(this.form.limitedtextarea,this.form.countd

Debug visually with Code Map debugger integration

Link gốc: http://s.ch9.ms/Series/Visual-Studio-2012-Premium-and-Ultimate-Overview/Visual-Studio-Ultimate-2012Debug-visually-with-Code-Map-debugger-integration

Controller và Actions trong ứng dụng ASP.NET MVC theo http://jou.vn

Bài viết đầu tiên của chương thứ II sẽ giới thiệu với bạn về controller và action trong ứng dụng ASP.NET MVC. Nền tảng ASP.NET MVC ánh xạ các URL đến các lớp được gọi là controller. Các controller được dùng để xử lý các request gọi đến, quản lý dữ liệu được nhập bởi người dùng, tương tác, và thực thi logic ứng dụng hợp lý. Một lớp controller thường gọi các view để sinh ra mã HTML trả về cho request. Lớp cơ bản nhất được các controller kế thừa có tên là ControllerBase, lớp này cung cấp các mã quản lý mô hình MVC chung nhất. Lớp Controller được kế thừa từ ControllerBase, và là lớp mặc định dùng cho việc cài đặt controller. Lớp Controller có trách nhiệm: TÌm kiếm action thích hợp để gọi và kiểm ra xem thử action đó có thể gọi được hay không. Lấy các giá trị được gởi lên từ request để sử dụng như là tham số cho các action Xử lý tất cả các lỗi có thể xảy ra trong suốt quá trình thực thi phương thức ac

Facebook Style Wall Posts and Comments using Knockout.js and ASP.NET Web API by http://techbrij.com

Hình ảnh
In this article, we will implement Facebook style wall posting with following features using Knockout.js , jQuery and ASP.NET MVC 4 with Web API . 1. Add new post and display the latest post first 2. Add new comment to post 3. Display date time in fuzzy time stamps (e.g. 5 mins ago..) 4. Auto-grow textarea for long posting and commenting 5. Comment link to toggle comment box 6. Display user avatar for posts and comments Here is the final output: Database Structure: The edmx view generated from database is as follows: In UserProfile table, AvatarExt is used to store extension of user thumbnail and it is stored in the application with UserId + . + AvatarExt. Post table is used for Wall posts and PostComment table is used for comments. Other tables(not displayed in the image, common tables) are used to implement SimpleMembershipProvider. Getting Started: 1. Create ASP.NET MVC 4 > Internet Application Project in VS2012. 2. In Models, Add new item “ADO.