Export DataTable to Excel with Open XML in c#

Experience The Creativity
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 to make it work.private static void WriteExcelFile(string outputPath, DataTable table){ using (SpreadsheetDocument document = SpreadsheetDocument.Create(fileToGenerate, SpreadsheetDocumentType.Workbook)) { WorkbookPart workbookPart = document.AddWorkbookPart(); workbookPart.Workbook = new Workbook(); WorksheetPart worksheetPart = workbookPart.AddNewPart<Wor

Configure StyleCop with MSBuild to treat Warnings as Errors

Experience The Creativity
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.MSBuildThen unload your project and open the project file to modify it.Now you have to add "StyleCopTreatErrorsAsWarnings" property inside "PropertyGroup" tag as below.<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"><PropertyGroup> <ErrorT

MVC 5 with Unity for Dependency Injection

Experience The Creativity
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 question. This tutorial is an step-by-step guide with screen-shots where you can learn how ...

Pass Complex JavaScript Object to MVC Controller

Experience The Creativity
In this tutorial I'm going to illustrate how we can pass complex javascript objects to MVC controller. Here are the Model objects. public class Project { public long ProjectID { get; set; } public string ProjectName { get; set; } } public class Employee { public string Code { get; set; } public string Name { get; set; } } ...

Android Web Service Access Tutorial

Experience The Creativity
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.jarHere is the sample code that illustrate SOAP web service call. I have access a live web service ConvertWeight

Android Login Screen Using HttpClient

Experience The Creativity
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 URL and get the response.package com.sencide;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.util.ArrayList;import java.util.List;import org.apache.http.Htt

SQL Server Authentication enabling using Microsoft SQL Server 2008 Management Studio

Experience The Creativity
Microsoft SQL Server Management Studio provides integrated environment for accessing, configuring, managing, administering and developing all components of SQL Server. There you can see two authentication modes called "Windows Authentication" and "SQL Server Authentication". The Windows authentication mode only allows you to login/connect to SQL Server with Windows authentication.If you install the

Install IIS in Windows 7 or Vista

Experience The Creativity
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 Turn Windows features on or off.Then select Internet Information

Create Simple Web Service in Visual Studio 2008 / 2010

Experience The Creativity
This tutorial explains how we can create simple Web Services using Visual Studio 2008 or Visual Studio 2010.If you are interested in creating web services in java, please follow my postCreate Web Service in Java Using Apache Axis2 and Eclipse1. Create the Web ServiceFirst create new project and select "New ASP.NET Web Service Application" and I'm giving the name "MyFirstWebService" ...

AJAX Using JQuery Tutorial

Experience The Creativity
You may know that, JQuery is a JavaScript library that we can do smart things using small pease of code. This free and open source JavaScript Library has become the most famous JavaScript Library today because of its Lightweight, Cross-browser and CSS3 Compliant. Using JQuery we can do thing like Document Navigating, DOM Element Selecting, Creating Animations, Event Handling and ...

Embed a Picture to Body of Gmail Message

Experience The Creativity
In this post I’m going to show you how to embed a picture to body of the message in Gmail without attaching. To get this work done you have to enable Image Inserting in Google Labs. Let’s see how we can enable this.First log in to your account and go to Settings as following picture;Then go to ...

ADD|Update|Delete Item SharePoint Web Services

Experience The Creativity
In one of my previous article I discussed how we can retrieve data in a SharePoint List Using its Web Services. In this post I’m going to discuss how we can update a SharePoint list using Web Services. Please refer my previous article on "SharePoint List Web Service GetListItems" to learn how to add Web References to your project. Then ...

SharePoint List Web Service GetListItems

Experience The Creativity
In this post, I’ going to discuss how we can retrieve data from a SharePoint List using its Web Services. First to know about SharePoint Web Services please refer this. We can user List Web Service which provides methods for working with SharePoint Lists, Content Types, List Items, and Files to read a List. Here we are going to use ...

SharePoint List GUIDs, How to Find?

Experience The Creativity
In this post I’m going to discuss about an easiest way to find GUID of a SharePoint list and a View. If you are using the MOSS 2007 there is straight forward way to get the List GUID, these are the steps.1. Access the list via your browser.2. Go to Settings --> List Settings and right-click on the "Information management ...

Add User To SharePoint Group Programmatically

Experience The Creativity
Let’s see how we can programmatically add a user to existing SharePoint user group . You can use the following method which has two string parameters, one for group name and other for user login name for get the above task done. public void addUserToGroup(string groupName, string userLoginName){ string strUrl = "http://mysite:5050/"; using (SPSite site = new SPSite(strUrl)) { using ...

Add Item To List With LookUp Column Programmatically

Experience The Creativity
In my previous posts on "Working With SharePoint List" I have discussed how we can Read, Add and Update SharePoint List. If you have to add new Item to a list which has lookup column, you have to follow a different procedure.If you look at the following figure, you can easily understand what I'm going to do. I'm going to ...

Create SharePoint List View Programmatically

Experience The Creativity
In this post I’m going to describe how you can programmatically add a view to SharePoint list or Document Library. You can get this work done by using SPViewCollection.Add Method (Microsoft.SharePoint), here is a sample code, public void createListView() { SPSite site = new SPSite("http://merdev-moss:5050/testsara"); SPWeb web = site.OpenWeb(); SPList list = web.Lists["Tasks"]; SPViewCollection allviews = list.Views; string viewName = ...

Add Permission Level To SharePoint User Group

Experience The Creativity
In this post I'm going to discuss how you can add a permission level (Read, Contribute, Full Control, etc) to a SharePoint user group. Here is a sample code, public void addPermissionToGroup() { SPSite site = new SPSite("http://mysite:5050/"); SPWeb spWeb = site.OpenWeb(); string permissionName = "Read"; string groupName = "Project Manager"; try { spWeb.AllowUnsafeUpdates = true; SPRoleAssignment roleAssignment = new ...

Add Menu Bar To Blogger Blog

Experience The Creativity
I was able to add a nice multilevel dropdown menu to my blog. In this post I’m going to discuss how you also can add it to your blogger blog. Here I’m using pure CSS multilevel menu generated by Free CSS Drop Down Menu Generator.You can’t use the code directly in blogger without some modifications; I’ll describe ...