Jack @ ASP.NET

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries for the ‘Visual Studio’ Category

Visual Studio LightSwitch

Microsoft Visual Studio LightSwitch helps you solve specific business needs by enabling you to quickly create professional-quality business applications, regardless of your development skills. LightSwitch is a new addition to the Visual Studio family. Visual Studio LightSwitch is designed to simplify and shorten the development of typical forms-over-data business applications.

Scenario: forms-over-data business
Advantages:

  •  simplify and shorten the development
  •  you do not need to know .net and etc.

The build-in starter kit
Customer Service
Application for managing customer accounts and invoices.

Expense Tracker
Application for creating and tracking expense reports.

Issue Tracker
Application for tracking issues logged to an IT helpdesk.

Job Candidate Tracker
Application for managing job applicants and open positions.

Performance Review
Application for tracking employee performance data.

Status Report
Application for tracking project updates and other statuses.

Time Tracker
Application for managing employee time entry.

Call web service via jQuery in asp.net

step 1. Add Web service, and you must add a [System.Web.Script.Services.ScriptService] to the service class

(in webservice.asmx.cs file)

   1: /// <summary>

   2: /// Summary description for WebService1

   3: /// </summary>

   4: [WebService(Namespace = "http://tempuri.org/")]

   5: [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

   6: [System.ComponentModel.ToolboxItem(false)]

   7: // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 

   8: [System.Web.Script.Services.ScriptService]

   9: public class WebService1 : System.Web.Services.WebService

  10: {

  11:     [WebMethod]

  12:     public string DeleteProduct(string id)

  13:     {

  14:         Thread.Sleep(800);

  15:         return "Hello World22: " + id;

  16:     }

  17: }

step 2. call webservice in aspx via jQuery

(in head of the page)

   1: <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

   2: <script type="text/javascript">

   3:     $(function () {

   4:         $('a').click(function () {

   5:             deleteProduct(111);

   6:         }); // end of  $('a').click(function () {

   7:  

   8:     });     // end of $(function () {

   9:  

  10:  

  11:  

  12:     function deleteProduct(id) {

  13:         $.ajax({

  14:             type: "POST",

  15:             url: "WebService1.asmx/DeleteProduct",

  16:             data: "{id: '" + id.toString() + "'}",

  17:             contentType: "application/json; charset=utf-8",

  18:             dataType: "json",

  19:             success: function (msg) {

  20:                 AjaxSucceeded(msg);

  21:             },

  22:             error: AjaxFailed

  23:         });

  24:     }

  25:     function AjaxSucceeded(result) {

  26:         alert(result.d);

  27:     }

  28:     function AjaxFailed(result) {

  29:         alert(result.status + ' - ' + result.statusText);

  30:     }  

  31: </script>

Web Essentials extension – Visual Studio 2010 add-on

The Web Essentials extension lets you perform common tasks much easier,

Features include:

  • Minify CSS
  • Same word highlighting
  • Code collapsing/outlining
  • Convert easily between hex, rgb and named color values
  • Right-click folder now includes Add JavaScript and Stylesheets
  • Adds SmartTags to selectors for targeting specific IE versions
  • Color preview on mouse hover
  • Font preview on mouse hover
  • Image preview on mouse hover
  • Support for regions /*#region MyRegion */
  • Brace matching
  • Minify JavaScript
  • Adds SmartTags to properties for targeting IE6 & IE7
  • Embed url() references as base64 strings
  • Drag and drop support for image, font, audio and video files

Download at http://visualstudiogallery.msdn.microsoft.com/6ed4c78f-a23e-49ad-b5fd-369af0c2107f

Entity Framework Code First

The “EF Code-First” functionality provides a pretty nice code-centric way to work with data.

Advantage

  • ·         Develop without ever having to open a designer or define an XML mapping file, and start from a class
  • ·         Define your model objects by simply writing “plain old classes” with no base classes required
  • ·         Use a “convention over configuration” approach that enables database persistence without explicitly configuring anything
  • ·         Optionally override the convention-based persistence and use a fluent code API to fully customize the persistence mapping. columbus oh website design

Disadvantage

  • Mapping entities to the database is quite complex
  • There is no Model diagram

HTML5 support in Visual Studio 2010 SP1

Visual Studio 2010 was originally released without HTML5 support, so does SP1 finally add support for it? Yes, to some extent. The entire HTML5 specification isn’t supported but most of the new elements and attributes are. That means you get both intellisense and validation for HTML5 with SP1.

Turn it on

After installing SP1 you have to tell Visual Studio to start using the HTML5 schema. Go to Tools -> Options, and then select Text Editor -> HTML -> Validation. You should now be able to select HTML5 or XHTML5 as the target schema.

clip_image002

Or if you have the HTML Source Editing toolbar enabled, you can select it in the target schema dropdown.

clip_image003

Visual Studio 2010 crash when creating a New Project

My visual studio 2010 crashed when creating a New Project. My environment is Windows 7 – 64 bit, Visual Studio 2010. And after google the solution, if got the solution

Delete or move the contents of C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache

Hope it may help the one also met this problem