Friday, December 16, 2011

Introduction to Commerce Server 2009

I was recently  given a Commerce Server technical session in my present company.I really enjoyed presenting the session with very enthusiastic Participants.
                               It was a good opportunity to give session on Commerce Server 2009.I enjoyed giving answers to the participants.
I have promised to all the participants that I will soon take more sessions on Commerce Server(Multi channel,Extending Order,Line items,Commerce Server Admin console,Commerce Server API etc..)
.Attached one of the presentation here.


Wednesday, November 30, 2011

Case Study on a IT Project Failure

Case Study on IT Project Fail

Wednesday, October 12, 2011

Client side validation not working in ASP.MVC 3

Add the following lines to your view.


HtmlHelper.ClientValidationEnabled = true;
HtmlHelper.UnobtrusiveJavaScriptEnabled = true;

Add the following script files reference to your web page

  1. jquery-1.4.4.js

  2. jquery.validate.js

  3. jquery.validate.unobtrusive.js

Friday, September 30, 2011

My blog has been visited more than 110 Countries

     Thanks to those you already visited my blog, and gave me suggestion,.Recently I have seen my blog statistics it saying that “This blog visited more than 110 countries”.
      I feel very happy.It encourage me to post more articles.This year I am trying to contribute more.
 Once again thanks for your comments and suggestions those helps to me a lot.


Cascading dropdown Implementation using jQuery

Cascading dropdown functionality is common requirement in every web application. Implementing cascading dropdown in JavaScript is very lengthy and takes lot of effort to use AJAX calls .

With jQuery you can write in simple way to achieve this. Here is the code for populate  the state dropdown based on the country dropdown selected value.

 <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $(document).ready(function () {
                $("#ddlCountry").change(function () {
                    var selectedItem = "";
                    selectedItem = $(this)[0].value; // get the selected ddlCountry id
                    var url = '/Home/AsyncGetStateList/?countryId=' + selectedItem;
                    $.get(url, function (data) {       // call controller's action
                        $.each(data, function (index, optionData) {
                            $("#ddrStates").append("<option value='"
                            + optionData.Text
                            + "'>" + optionData.Value
                            + "</option>");

New optimized code

The above code has totally 21 lines. This we can optimize to 12 lines. Here is the code.


 <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $("#ddlCountry").change(function () {
                $.getJSON("/Home/AsyncGetStateList", { countryId: $("#ddlCountry option:selected").val() }, function (data) {
                    $.each(data, function (index, optionData) {
                        $("#ddrStates").append("<option value='"
                                           + optionData.Text
                                          + "'>" + optionData.Value
                                           + "</option>");

Check box click example using jQuery


<script language="javascript" type="text/javascript">
      $(document).ready(function () {
          $('#EFFND').click(function () {

Action method calling twice in ASP.NET MVC

         This happens due to many reasons.In one my project i have faced this  was an image with an
empty “src”  property and that would call controller once again.

        This is not the issue with  ASP.NET MVC .It is browser behavior .If the response form(Web form )
having any broken div tags  (Unclosed div tags) or Image source is empty then browser thinking that
form not loaded properly and resubmit the form .It causes to call action method twice in ASP.NET MVC

    Precautions to  prevent the issue

  • Maintain all image tags having  “src” or Image URL (if control is ASP.NET ) with valid image url
  • Add alternative description for every image control (ex:  alt=”Home Banner”)
  • Check all div tags closed properly in Web page
  • Validate your each web page once the development is  completed

Once you specify your webpage “url”  in the site and click on check button .it shows the list of issues and description of respective error

Ex: One of the sample web page I have validated using . The result you can find below  snap shot


Thursday, September 29, 2011

Solution for Prevent closing IE browser when stop debugging in Visual Studio

When  your run the  application with IE browser you will face one issue that is after stop the debugging  Visual Studio automatically  closes your IE browser


Here is the solution to prevent the closing IE browser


->Click on start debug button in toolbar

->Once the application is running in IE browser

->Click on Detach All as I  showing below  when ever you  don’t want to debug

->Now your browser will not close .



Wednesday, September 21, 2011

The maximum message size quota for incoming messages , has been exceeded. To increase the quota,..WCF exception


                                        Recently i got this exception when i work with WCF service. One of the Web Method returns heavy data.It is not an issue. The problem hear is  maxReceivedMessageSize is exceeded .         
The Default value of maxReceivedMessageSize is "65536". We can change this value upto "2147483647".I have increased the size of maxBufferSize,maxReceivedMessageSize  in Web.config file (Binding section).

The problem got resolved .




Note: Don’t copy all the code .Only change the maxBufferSize,maxReceivedMessageSize  as I specified in below .

<binding name="BasicHttpBinding_Service1" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />

Happy coding ..

Friday, September 16, 2011

ASP.NET MVC - An item with the same key has already been added

ASP.NET MVC having power full mechanism of model binding.Whatever data HTTP request carries from the client  side to server  ASP.NET MVC engine

takes the all keys and binds  the values to relevant properties .If the Model contains more than one key with same name ASP.NET throws this

exceptions .

Solution :

1.Identify the duplicated  properties in the model (May be your model inherited some base model which is having same key )
   and rename with unique name

2.Same name with different data types also you will face the exceptions.So change the data type If you have more than
    one property in model or base classes.

Tuesday, August 30, 2011

Error handling in getJSON call using jQuery

You can  handle errors in a getJSON calls .There are two ways to handle errors

1) Configuring your Ajax calls before actually calling(Recommended way)
2) Specifically (with method chain).
In this post i would like to give a example on First method.It is preferred way to handle the errors.In the example code i have used
alert to display

error status ,error thrown, response text thrown by server.You can only display status or Response test based on your requirement

Example Code:

$(document).ready(function () {
            $(document).ready(function () {
                $.ajaxSetup({ "error": function (XMLHttpRequest, textStatus, errorThrown) {
           // Write your Getjson call here.
           // $("#ddlCountry").change(function () {

Tuesday, July 19, 2011

Successfully given a session on JQuery

                                I was recently  given a jQuery technical session in my present company.I really enjoyed presenting the session with very enthusiastic Participants.
                               It was a good opportunity to explore and discover more stuff in jQuery.I enjoyed giving answers to the participants.I have promised to all the listener that I will soon take one more session on "jQuery" to more talk about validation ,various plugins,Asynchronous calls and jQuery UI controls and I will keep my promise.Attached one of the presentation.


Tuesday, June 21, 2011

ASP.NET MVC at a Glance

A simple way to understand ASP.NET MVC.

Controllers: Classes that handle incoming requests to the application, retrieve model data, and then specify view templates that return a response to the client.
Models: Classes that represent the data of the application and that use validation logic to enforce business rules for that data.
Views: Template files that your application uses to dynamically generate HTML responses

Thursday, June 16, 2011

New features in ANTS Performance Profiler v.6.1

ANTS Performance Profiler v.6.1The following new features they have introduced .

Added new Application types
The new Ants perfomance profiler  supports .NET framework 4.0 ,Silverlight and XAML browser application.
The new Ants profiler having excellent features callled Attach to process .Using this we can attach to running .NET 4 process.

In-Built Sql server and File I/O analysis

    SQL Server :  Using this we can analyze the sql queries and store procedures any time .
    File I/O  :   Using this we can analyze what are the DLL s/Files using when the application that you are profiling reads from discs or writes.

Command Line:

                     We can Profile application using command line also. Using this we can generate  total report as HTML page .

Saturday, May 7, 2011

Retrieve all key-value pairs in a resource file

                                   Recently i have got one of the requirement in my project to retrieve all key/value pairs in a particular resource file.We know how to  retrieve any text value in any file knowing its key.A search revealed that I might be able to use ResXResourceReader class and iterate through the pairs; however the class is unfortunately located in the System.Windows.Forms.dll and I don't want to wire that dependency to my web app.

 So finally i have achieved it .Here is the solution.
public static IDictionary<object, object> GetResourceSet(string resourceKey, string resourceFile, CultureInfo cInfo)
string resourceValue = "";
IDictionary<object,object> resourceDictionary=null;
if (resourcesDirectory != string.Empty)
resourceDictionary = new Dictionary<object, object>();
impResx = System.Resources.ResourceManager.CreateFileBasedResourceManager(resourceFile, resourcesDirectory, null);
var ResourceSet = impResx.GetResourceSet(cInfo, false, true);
foreach (DictionaryEntry entry in ResourceSet)
resourceDictionary.Add(entry.Key, entry.Value);
catch (Exception ex)
throw ex;

Friday, April 15, 2011

Cascading Dropdown in ASP.NET MVC using jQuery






$(document).ready(function () {
    $.ajaxSetup({ "error": function (XMLHttpRequest, textStatus, errorThrown) {
    $("#ddrCountry").change(function () {
        var url = "/Home/AsyncGetCountryLists";
        $.getJSON(url, { siteId: $("#ddrCountry option:selected").val() }, function (data) {
            $("#ddrState").append("<option value=''> </option>");
            $.each(data, function (index, optionData) {
                $("#ddrState").append("<option value='"
                                           + optionData.Value
                                          + "'>" + optionData.Text
                                           + "</option>");

Wednesday, March 23, 2011

Visual studio Light switch


                              Visual Studio LightSwitch is a application development environment.It is a new addition to the Visual Studio family. Using Visual Studio LightSwitch you can develop a high-quality business application simpler and faster way without writing single line of code. It is power full development platform for creating applications for desktop and the cloud .Light Switch includes a lot of pre-built components for the most common business application tasks.

                     Click here  download the Light switch Beta 2 from following location. After success fully installed the Light switch open the visual studio and go to menu  -->file –> New project  (you can find the Light switch in your template list .

The below picture shows the light switch in Visual studio


Thursday, March 17, 2011

JavaScript alert box with custom title

               Recently one of my friend got a requirement on customization of  JavaScript alert box.The requirement is  customizing the alert box title.There is no way to customize the alert box title  in Java Script.I have given a solution using jQuery alert box.I have discussed possible ways to implement it and I have mentioned my recommendation also.

  1. Creating new page (.html or .aspx) name it as "Message box" and  pop up it using
  2. The second ways is using vb script .But it is only works in IE browser.
  3. Jquery plug in .(Recommended way).The below example demonstrate you how to use jquery alert box plug in .

Add the  following file reference to your page header.

<script src="Scripts/jquery-1.4.1.js" type="text/javascript"/>
  <script src="Scripts/jquery.alerts.js" type="text/javascript"/>
  <link href="Styles/jquery.alerts.css" rel="stylesheet" type="text/css"/>

Add a button in your page

<asp:Button ID="Button" runat="server" Text="Click Me" />

Add this content to your in between  header tag

   1: <script type= "text/javascript" language="javascript">
   2:      $(document).ready(function () {
   3:          $("#Button").click(function () {
   4:              jAlert('Wow !My alert message with custom titile','My custom title bar here...');
   5:              return false;
   6:          });
   7:      });

Run the application .Now you can find the following out put .Let me know if you face any issues .CustomTitle