How to Configure Salesforce for Outlook – Video Tutorial

This Video Tutorial will help to beginners on basic setup of Salesforce for Outlook.

  1. How to create Outlook Configuration
  2. Which objects can be synchronized
  3. Deciding on direction of Synchronization
  4. Creating DataSet
  5. Attach Email with any record
  6. Setting field mapping for Custom fields of Contact in Outlook and in Salesforce Continue reading “How to Configure Salesforce for Outlook – Video Tutorial”

microsot Excel – Change content of alternate cell on change of the cell value using macros

Using VBA script to change the content of alternate column on the basis of value changed in other column of excel sheet

Microsoft excel is very powerful tool to work on the related data. This time i needed a unique functionality in excel sheet and wanted to share with you all. So to create the macro enabled excel sheet, while saving file in file types, select the micro enabled workbook. In Microsoft Excel 2010 the extension of such type of file is “xlsm”.

Requirement:

on changing of auto complete column, a message box should appear and after clicking on button, the adjacent cell value should get changed as shown in below image:

Change content of alternate cell on change of the cell value using macros
Change content of alternate cell on change of the cell value using macros

Continue reading “microsot Excel – Change content of alternate cell on change of the cell value using macros”

Create a custom Web service in Salesforce and consume it in C#.Net application

In this tutorial, we will create the web service in salesforce and consume it in c#.Net application

In Previous article, we have consumed the standard enterprise wsdl of the salesforce. In this article we will create the webservice using apex in salesforce and consume it in C#.Net application.

In Salesforce create below class (using force.com IDE)

global public with sharing class SaveExpenditureWebService {

	webservice static Expenditure__c createExpenditure(Decimal amount,String expName, String paidByName )
	{
		Expenditure__c c = new Expenditure__c();
		Person__c p = [Select p.Name From Person__c p Where Name = :paidByName limit 1];
		c.Amount__c = amount;
		c.Name = expName;
		c.Exp_Date__c = Date.today();
		c.Paid_By__c = p.Id;
		insert c;

		return c;
	}
}

Note:

  • Apex class in which webservice is going to be written must be declared “global“.
  • Keyword “webservice“ must be used for a method which should be exposed as a webservice.
  • Method must be declared as static.

In above code, I am using a custom object “Expenditure__c“ to insert into Salesforce.  Any type of code can be written.
Now in C#, create windows application with following controls:

Create Custom web service in salesforce using apex and consume using C#.Net
Create Custom web service in salesforce using apex and consume using C#.Net

Continue reading “Create a custom Web service in Salesforce and consume it in C#.Net application”

Consume Salesforce Web service in C# .Net Application

Author posted by Jitendra on Posted on under category Categories c#, Salesforce and tagged as Tags , with 14 Comments on Consume Salesforce Web service in C# .Net Application

This tutorial is the demonstration of how to consume the web service from salesforce.

In this example, we are going to consume the enterprise WSDL of the Salesforce in C# application.

Log into the Salesforce and navigate to “Your Name | Setup | App Setup | Develop | API” and select the “Generate Enterprise WSDL”.  Copy the URL, as we will need this in our C# Application.

Now Open Visual Studio (I am using Visual Studio 2010) and create new Windows Application. The UI of the application should look like:

C# Application to consume salesforce webservice
C# Application to consume salesforce webservice

Right click on the “References“ folder and select “Add Service Reference“.

Add Service Reference in C#
Add Service Reference in C#

Continue reading “Consume Salesforce Web service in C# .Net Application”

ASP.NET Page Lifecycle

Author posted by Jitendra on Posted on under category Categories ASP.NET, Tech Tips and tagged as Tags with Leave a comment on ASP.NET Page Lifecycle

Tutorial and sample source code on ASP.NET Page Lifecycle

Introduction

Understanding Page lifecycle is very crucial in order to develop ASP.NET applications. Most beginners tend to get confused while dealing with “dynamic controls” and face problems like losing values, state etc on postbacks. Since HTTP is stateless, the nature of web programming is inherently different from windows application development, and the Page lifecycle is one of the primary building blocks while learning ASP.NET. The sequence of events, especially while working with MasterPages in ASP.NET 2.0, has become slightly more complex and this article is aims to shed some light on these events by explaining the order and importance of each event.

Background

Whenever the user requests a particular “.aspx” page in an application, a lot of interesting things happen on the web server where the application is hosted. Understanding this sequence of events will help us to program and respond to events properly and also clear any confusion which generally arises due to the stateless nature of web programming.

The New Compilation Model and the Partial Classes

Each web form in an ASP.NET application derives directly or indirectly from a “System.Web.UI.Page” class. A web form has two components: a code behind file (Default.aspx.cs) which contains the code for the events and other methods related to a Page, and the designer ASPX file(Default.aspx), which contains HTML control declarations and events (in the Visual Studio 2005 Web Application project model, we have a designer class named WebForm.aspx.designer.cs).

In ASP.NET 2.0, we do not need to define the control variables as well as there event handlers in the code behind, thanks to Partial classes. In ASP.NET 1.x, all this code was auto generated and placed in the code behind file under InitializeComponent() section. But in version 2.0, the runtime will create a partial class dynamically from the ASPX page containing all this info and merge it with the code behind partial class. This will help in making the actual code behind class a lot cleaner and more manageable.

Also, this would eliminate the name change related issues which were common in VS 2003 (if we change any control’s ID, it had to be changed everywhere and VS used to modify the code many times). All control related events are defined in the ASPX markup code. So having a single place for controls names and event handlers is cleaner and flexible, whereas the previous VS 2003 model was more “brittle”.

The Page life cycle

It is very important to know that for each request, the Page class is instantiated everytime from “scratch”. Which means that any values or whatever state it had previously will get lost unless we use one of the various state maintainance mechanisms provided by ASP.NET like Application, Session, Cache variables or Cookies.

Side Note: View state in ASP.NET 2.0 has changed and now comprises of two parts: Control State and View state. Refer this article for details.

Below is the sequence of events which fire up sequentially with explanation on the relative importance with respect to web programming in code behind:

1. PreInit()

In this Page level event, all controls created during design time are initialized with their default values. For e.g., if you have a TextBox control with Text property = “ShivaSoft”, it would be set by now. We can create dynamic controls here.

This event occurs only for the Page class and “UserControls / MasterPages do not have this method to override“.

Sample code where you can override this method :

Syntax :

    protected override void OnPreInit(EventArgs e)
    {
        //custom code
        base.OnPreInit(e);
    }

Note that PreInit() is the only event where we can set themes programmatically.

Continue reading “ASP.NET Page Lifecycle”

Default Submit button in ASPX or Master Page

Author posted by Jitendra on Posted on under category Categories ASP.NET and tagged as Tags with Leave a comment on Default Submit button in ASPX or Master Page

How to handle the default submit button in aspx page having contentplaceholder that is master page

In ASPX page, if there is only one button one which postback is done then there is no problem. However in a case when there are lots of button in page the how you will tell aspx page that which button’s event is default?

To solve that we have to use the “defaultButton” attribute of the “form” tag as shown in below code snap:

<form id="form1" runat="server" defaultbutton = "imgSearch" >
....
....
<asp:ImageButton Visible="true" ID="imgSearch" runat="server"/>
<asp:ImageButton Visible="true" ID="imgDelete" runat="server"/>
</form>

In above code, the string value supplied to argument “DefaultButton” is the ID of the button control which should made default. Continue reading “Default Submit button in ASPX or Master Page”

Access Modifiers / Specifiers in C# Language

Author posted by Jitendra on Posted on under category Categories c# and tagged as Tags with 1 Comment on Access Modifiers / Specifiers in C# Language

Available Access Modifiers / Specifiers in C# Language

Access Modifiers (Access Specifiers) describes as the scope of accessibility of an Object and its members. All C# types and type members have an accessibility level . We can control the scope of the member object of a class using access specifiers. We are using access modifiers for providing security of our applications. When we specify the accessibility of a type or member we have to declare it by using any of the access modifiers provided by CSharp language.

C# provide five access specifiers , they are as follows :

  • public
  • private
  • protected
  • internal
  • protected internal

public :

public is the most common access specifier in C# . It can be access from anywhere, that means there is no restriction on accessibility. The scope of the accessibility is inside class as well as outside. The type or member can be accessed by any other code in the same assembly or another assembly that references it.

private :

The scope of the accessibility is limited only inside the classes or struct in which they are declared. The private members cannot be accessed outside the class and it is the least permissive access level.

protected :

The scope of accessibility is limited within the class or struct and the class derived (Inherited )from this class.

internal :

The internal access modifiers can access within the program that contain its declarations and also access within the same assembly level but not from another assembly.

protected internal :

Protected internal is the same access levels of both protected and internal. It can access anywhere in the same assembly and in the same class also the classes inherited from the same class .

Microsoft Visual C# 2008 Compiler could not be created. QueryService for ‘{7D960B16-7AF8-11D0-8E5E-00A0C911005A} failed

Resolve error – Microsoft Visual C# 2008 Compiler could not be created. QueryService for ‘{7D960B16-7AF8-11D0-8E5E-00A0C911005A} failed

While i was working on Console application, suddenly i get below error saying – Microsoft Visual C# 2008 Compiler could not be created. QueryService for ‘{7D960B16-7AF8-11D0-8E5E-00A0C911005A} failed.

To resolve this error, i re-installed the visual studio, but it didn’t helped me.
Then i run below command –


C:Program FilesMicrosoft Visual Studio 9Common7IDE devenv.exe /resetsettings

It also, not worked.

Then i searched for below command and it worked very well.

C:Program FilesMicrosoft Visual Studio 9Common7IDEdevenv.exe /ResetSkipPkgs

Tutorial – Read and export excel file in ASP.Net using C#

Author posted by Jitendra on Posted on under category Categories ASP.NET, c# and tagged as Tags , with 1 Comment on Tutorial – Read and export excel file in ASP.Net using C#

Tutorial – Read and export excel file in ASP.Net using C#

Hi Readers,
In this article, i am going to show you that how to read excel file in C# and exporting it into ASP.Net. You might need this type of code when you want to read the file from server and export to the client.
Following will be the application look like :

Read And Export Excel in ASP.Net
Read And Export Excel in ASP.Net

Continue reading “Tutorial – Read and export excel file in ASP.Net using C#”

Change the applicaions icon in Windows xp

Author posted by Jitendra on Posted on under category Categories Microsoft and tagged as Tags with Leave a comment on Change the applicaions icon in Windows xp

Change the applicaions icon in Windows xp

Recently, i had deleted the files under installer folder of windows to clean up the space and that leads to one problem. All the icons of Microsoft Office was disappeared and i was not able to set the icon anyways.

But i had worked on changing the icon in past and helped me to setup the new icon for Microsoft office 2007 or any other application.

To set the icon perform following steps:

Go to Tools | Folder Option and select “File Types” tab.

Windows XP Folder Option
Windows XP Folder Option

Continue reading “Change the applicaions icon in Windows xp”