Friday, November 27, 2015

Export DataTable to Excel with Open XML in c#

This code sample will illustrate how we can create Excel file from a data table in c#. You will need to add DocumentFormat.OpenXml and WindowsBase dll references to make it work. private static void WriteExcelFile(string outputPath, DataTable table) { using (SpreadsheetDocument document = SpreadsheetDocument.Create(fileToGenerate, SpreadsheetDocumentType.Workbook)) { WorkbookPart workbookPart...

Wednesday, June 10, 2015

Configure StyleCop with MSBuild to treat Warnings as Errors

We can easily configure StyleCop with MSBuild to make warnings appear as errors with the help of StyleCop.MSBuild NuGet package. First go to Package Manager Console and install it with following command. Install-Package StyleCop.MSBuild Then unload your project and open the project file to modify...

Wednesday, April 22, 2015

MVC 5 with Unity for Dependency Injection

Dependency Injection allows us to inject objects into a class, instead of constructing them internally. Unity is a dependency injection container that we can use for constructor, property, and method call injections. You can get good idea about dependency injection by reading answers to this stack-overflow...

Wednesday, January 22, 2014

Pass Complex JavaScript Object to MVC Controller

In this tutorial I'm going to illustrate how we can pass complex javascript objects to MVC controller. I have two Model objects called Project and Employee as below. public class Project { public long ProjectID { get; set; } public string ProjectName { get; set; } } ...

Tuesday, October 25, 2011

Android Web Service Access Tutorial

In this post I'm going to illustrate how we can access web service in Android using ksoap2-android project that provides a lightweight and efficient SOAP library for the Android platform. You can download the jar file from following link; http://ksoap2-android.googlecode.com/svn/m2-repo/com/google/code/ksoap2-android/ksoap2-android-assembly/2.5.8/ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar Here...

Tuesday, June 21, 2011

Android Login Screen Using HttpClient

I have updated this code to use web service and open new screen if the login is successful in my post Android Web Service Access Tutorial. In Android we can use HTTP POST request with org.apache.http.client.HttpClient to post data to a URL. This sample project illustrate how we can post data to a...

Wednesday, June 8, 2011

SQL Server Authentication enabling using Microsoft SQL Server Management Studio

If you install the Microsoft SQL Server using Windows Authentication mode, the "sa" account is disabled by default. So if you plan to use SQL Server Authentication, you have to enable the "sa" account. This tutorial tells you how to enable the "sa" account. 1. First, Login to the SQL Server Management...

Tuesday, October 5, 2010

Install IIS in Windows 7 or Vista

This tutorial discuss how you can enable (Internet Information Service) IIS in Windows 7 or Windows Vista. I have provided screen-shots so that you can easily understand. First go to control panel and select Programs. Then select Internet Information Services. (If you plan to run web services...

Wednesday, September 29, 2010

Create Simple Web Service with Visual Studio

This tutorial explains how we can create simple Web Services using Visual Studio. 1. Create the Web Service First create new project and select "New ASP.NET Web Service Application" and I'm giving the name "MyFirstWebService" to it, you can give any name to your project. Now you can see auto...

Saturday, February 20, 2010

Form Validation and Suggestions using JQuery & PHP

In this post I’m going to describe about a practical use of my previous article JQuery AJAX. Here I’m going to discuss how to validate a form and how to add auto suggests to a form using JQuery and PHP. Download Source (Password : sara) In the above I have given you the source code of the whole...