Friday, November 15, 2013

ರಾಜ್ಯೋತ್ಸವ ಪಂಚ್

ಸಾಕಿನ್ನು ಈ ಎನ್ನಡ, ಎಕ್ಕಡ
ಇನ್ನಾದರೂ ಎದೆತುಂಬಿ ಹೇಳು ಸಿರಿಗನ್ನಡ

ಅಮ್ಮ

ಅಮ್ಮಾ ನಿನ್ನ ಮಡಿಲಲ್ಲಿ ನಾನು ಮತ್ತೊಮ್ಮೆ ಮಗುವಾಗುವ ಆಸೆ
ಏನನು ತಿಳಿಯದ ಮುಗ್ದನಗೆಯ ಬೀರುವ ಮುದ್ದು ಕಂದಮ್ಮನಾಗುವ ಆಸೆ||ಪ||
ಕಾಗೆಯ ಕರೆಯುತ,ಚಂದಿರನ ತೋರಿಸುತ ಗುಮ್ಮನು ಬರುವ ಎಂದು ಹೆದರಿಸುತ
ಮಮ್ಮನು ತಿನಿಸಿದ ದಿನಗಳು ಇನ್ನು ಮರೆತಿಲ್ಲ.

ಅಮ್ಮಾ ನಿನ್ನ ಮಡಿಲಲ್ಲಿ ನಾನು ಮತ್ತೊಮ್ಮೆ ಮಗುವಾಗುವ ಆಸೆ
ಏನನು ತಿಳಿಯದ ಮುಗ್ದನಗೆಯ ಬೀರುವ ಮುದ್ದು ಕಂದಮ್ಮನಾಗುವ ಆಸೆ||ಪ||
ಬರೆಯ ಬೇಕೆಂದಿರುವೆ ಆ ದೇವರಿಗೆ ಕಾಗದವೊಂದನು
ಮರಳಿ ಕೊಡುವುದಾದರೆ ಆ ಬಾಲ್ಯವನ್ನು ಹೊತ್ತೊಯಿ ಈ ಎಲ್ಲಾ ಸುಕವನು
ಇನ್ನೆನನೂ ಬೇಡೆನು ಹೊರತಾಗಿ ಅಮ್ಮನ ನಗೆಯನು.

ಅಮ್ಮಾ ನಿನ್ನ ಮಡಿಲಲ್ಲಿ ನಾನು ಮತ್ತೊಮ್ಮೆ ಮಗುವಾಗುವ ಆಸೆ
ಏನನು ತಿಳಿಯದ ಮುಗ್ದನಗೆಯ ಬೀರುವ ಮುದ್ದು ಕಂದಮ್ಮನಾಗುವ ಆಸೆ||ಪ||
ಪಕ್ಕದ ಮನೆಯ ಪುಟ್ಟನು ಕುಯಿ ಕುಯಿ ಎನ್ನುವ ಚಪ್ಪಲಿ ಹಾಕಿ ಸದ್ದನು ಮಾಡುತ
ಬಂದಾಗಲೆಲ್ಲ ಕಾಡುವದೊಂದೇ  ಪ್ರಶ್ನೆ ಹೆಜ್ಜೆಯ ಮೇಲೊಂದು ಹೆಜ್ಜೆಯನಾಕುತ
ವಾಲುತ,ತೂಗುತ ಕಲಿತ ಮೊದಲ ಹೆಜ್ಜೆಯ ನನಗೇಕೆ ನೆನಪಿಲ್ಲ.

ಅಮ್ಮಾ ನಿನ್ನ ಮಡಿಲಲ್ಲಿ ನಾನು ಮತ್ತೊಮ್ಮೆ ಮಗುವಾಗುವ ಆಸೆ
ಏನನು ತಿಳಿಯದ ಮುಗ್ದನಗೆಯ ಬೀರುವ ಮುದ್ದು ಕಂದಮ್ಮನಾಗುವ ಆಸೆ||ಪ||
 

Monday, November 11, 2013

ಸವಿಗನ್ನಡ


ಅಮ್ಮನಿತ್ತ ಮೊದಲ ಮುತ್ತಲಿದೆ ನನ್ನ ಕನ್ನಡ

ಅವಳು ಕೊಟ್ಟ ಕೈತುತ್ತಲು ಬೆರೆತು ಹೋಗಿದೆ ನನ್ನ ಸವಿಗನ್ನಡ

ಜಾಗತೀಕರಣ ಎನ್ನೋ ಮಾಯೇ ಇಂದು ನೀ ಬಿಡುಯೆನ್ನುವದಾದರೆ ಬಿಟ್ಟುಬಿಡುವೆ

ಪಾಪಿ ಪ್ರಾಣವನ್ನ, ಬಿತ್ತುಕೊಡಲಾರೆ ಕನ್ನಡದ ಒಂದು ಅಕ್ಷರವನ್ನ
-ಜೈ ಕರ್ನಾಟಕ ಮಾತೇ

Saturday, August 17, 2013

ನನ್ನ ದೇಶ ಭಾರತ


ಹಾರುತಿಹುದು,ಏರುತಿಹುದು ನೋಡು ನಮ್ಮ ಬವುಟ
ಹೆಮ್ಮೆಯಿಂದ ಹೇಳುವೆ ನಾನು ನನ್ನ ದೇಶ ಭಾರತ
ಕಾಶ್ಮೀರದಿಂದ ಕನ್ನ್ಯಾಕುಮರಿವರೆಗೂ ಹರಡಿರುವ ಸುಂದರ ನಾಡು ನನ್ನ ಭಾರತ
ಶತ ಶತಮಾನದಿಂದ ಸಾಕಿ ಸಲಹುತಿಹ ತಯಿಯವಳು,ಪ್ರೀತಿಯಿಂದ ಕರೆವೇ ನಾ ಭಾರತಾಂಬೆ ಎನ್ನುತ
ಅವಳ  ಮಡಿಲಿನಲ್ಲಿ ನೂರಾರು ಭಾಷೆಯುಂಟು ,ಸಾವಿರಾರು ಜಾತಿಗಳುಂಟು
ಅದರೇನು ಯಾರು ಇಲ್ಲಿ  ಮೇಲೂ ಅಲ್ಲ ,ಯಾರು ಇಲ್ಲಿ ಕೀಳು ಅಲ್ಲ  ಒಂದಾಗಿ ಬಾಳುತಿಹೆವು ಒಂದೇಮಾತರಂ ಎನ್ನುತ
ದೇಶಕಾಗಿ ಪ್ರಾಣ ಕೊಟ್ಟ ವೀರ ಯೋಧರು ಹುಟ್ಟಿಬಂದ ನಾಡಿನಲ್ಲಿ ಬಾಳುತಿರುವ ಹೆಮ್ಮೆನನಗಿದೆ
ಪಾಪ ಕಳೆಯಲು ಗಂಗೆಯುಂಟು, ಧ್ಯಾನಕಾಗಿ ಯೋಗಿಗಳಿಹರು,ಕೋಗಿಲೆ ಕಂಟದ ಗಾಯಕರಿಹರು,ನನಗೇನು ಕಮ್ಮಿ, ಹೆಮ್ಮೆಯಿಂದ ಬೀಗುತಿರವೆ,ನನ್ನ ದೇಶ ಭಾರತ,ನನ್ನ ದೇಶ ಭಾರತ...

 

Friday, May 31, 2013

Show gridlines in Listview control on Compact framework


Below is the sample code to demonstrate the Grid lines in ListView Control on compact framework.

using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace SmartDeviceProject2
{
    public partial class ListViewControl : Form
    {
        DataTable dtEmployees = new DataTable("EmpList");
        private const uint LVM_FIRST = 0x1000;
        private const uint LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54;
        private const uint LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55;
        private const uint LVS_EX_GRIDLINES = 0x00000001;
        [DllImport("coredll.dll")]
        private static extern uint SendMessage(IntPtr hwnd, uint msg, uint wparam, uint lparam);
        public ListViewControl()
        {
            InitializeComponent();
        }
        private void createEmpTable()
        {
            dtEmployees.Columns.Add("S", typeof(Boolean));
            dtEmployees.Columns.Add("EmpNo", typeof(String));
            dtEmployees.Columns.Add("EmpName", typeof(String));
        }
        private void ListViewControl_Load(object sender, EventArgs e)
        {
            createEmpTable();
        }
        private void BindListView()
        {
            DataRow dr = dtEmployees.NewRow();
            dr["S"] = true;
            dr["EmpNo"] = "1";
            dr["EmpName"] = "Shreekanth Gaanji";
            dtEmployees.Rows.Add(dr);
            dr = dtEmployees.NewRow();
            dr["S"] = false;
            dr["EmpNo"] = "2";
            dr["EmpName"] = "Ashwini Gaanji";
            dtEmployees.Rows.Add(dr);
            dr = dtEmployees.NewRow();
            dr["S"] = false;
            dr["EmpNo"] = "3";
            dr["EmpName"] = "Manjunath Gaanji";
            dtEmployees.Rows.Add(dr);
            ColumnHeader colHeader_S = new ColumnHeader();
            ColumnHeader colHeader_EmpNo = new ColumnHeader();
            ColumnHeader colHeader_EmpName = new ColumnHeader();
            colHeader_S.Text = "S";
            colHeader_S.TextAlign = HorizontalAlignment.Left;
            colHeader_S.Width = (ClientSize.Width * 10) / 100;
            colHeader_EmpNo.Text = "EmpNo";
            colHeader_EmpNo.TextAlign = HorizontalAlignment.Left;
            colHeader_EmpNo.Width = (ClientSize.Width * 40) / 100;
            colHeader_EmpName.Text = "EmpName";
            colHeader_EmpName.TextAlign = HorizontalAlignment.Left;
            lstEmployees.View = View.Details;
            lstEmployees.FullRowSelect = true;
            lstEmployees.CheckBoxes = true;
            lstEmployees.Columns.Add(colHeader_S);
            lstEmployees.Columns.Add(colHeader_EmpNo);
            lstEmployees.Columns.Add(colHeader_EmpName);
            ListViewItem itemGroupName;
            for (int i = 0; i < dtEmployees.Rows.Count; i++)
            {
                itemGroupName = new ListViewItem();
                itemGroupName.Checked = Convert.ToBoolean(dtEmployees.Rows[i]["S"]);
                itemGroupName.SubItems.Add(Convert.ToString(dtEmployees.Rows[i]["EmpNo"]));
                itemGroupName.SubItems.Add(Convert.ToString(dtEmployees.Rows[i]["EmpName"]));
                lstEmployees.Items.Add(itemGroupName);
            }
            EnableGridlines(lstEmployees);
        }
        public void EnableGridlines(ListView listView)
        {
            var style = SendMessage(
                    listView.Handle,
                    LVM_GETEXTENDEDLISTVIEWSTYLE,
                    0,
                    0);
            style |= LVS_EX_GRIDLINES;
            style = SendMessage(
                   listView.Handle,
                   LVM_SETEXTENDEDLISTVIEWSTYLE,
                   0,
                   style);
        }
    }
}


Here is the OutPut.

 

Allow only numeric characters in TextBox

private void txtQuantity_KeyPress(object sender, KeyPressEventArgs e)

{

// Number Validation(only Number allowed)

if (e.KeyChar != (char)Keys.Back && !Regex.IsMatch(e.KeyChar.ToString(), "\\d+"))

{

e.Handled =
true;

}

}

Friday, May 24, 2013

Reading Resful WCF response using JQuery

About WCF :

WCF services in enterprises are used for developing distributed enterprise application. There are lots of advantages of using WCF services.WCF 3.5 had introduced support for Representational State Transfer (REST) using which the response from the service can be directly send using Plain Old Xml form (POX). If the WCF service is using REST/POX, then it is not necessary for the client to consume the WCF service proxy.For REST, WCF introduced a new binding i.e. WebHttpBinding. A client application that can do HTTP communication and can process XML, could now directly make a call to the WCF service and perform operations using XML.


My service.svc file looks as below.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.ServiceModel.Activation;
namespace WcfService1
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class Service1 : IService1
    {
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }
        public Employee[] getEmployee()
        {
            return new Employee[]
            {
                 new Employee() {Firstname="Manjunath",LastName="Gaanji"},
                new Employee() {Firstname="Shreekanth", LastName="Gaanji"},
                new Employee() {Firstname="Mahantesh",LastName="Kendhuli"},
                 new Employee() {Firstname="Ravi",LastName="Patil"}
              
            };
        }
        public CompositeType GetDataUsingDataContract(CompositeType composite)
        {
            if (composite == null)
            {
                throw new ArgumentNullException("composite");
            }
            if (composite.BoolValue)
            {
                composite.StringValue += "Suffix";
            }
            return composite;
        }
    }
}

Interface looks as below.

My interface looks as below.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace WcfService1
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IService1
    {
        [OperationContract]
        string GetData(int value);
        [OperationContract]
        CompositeType GetDataUsingDataContract(CompositeType composite);
        [OperationContract]
        [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/getShreekData", RequestFormat = WebMessageFormat.Xml)]
        Employee[] getEmployee();
    }

    // Use a data contract as illustrated in the sample below to add composite types to service operations.
    [DataContract]
    public class CompositeType
    {
        bool boolValue = true;
        string stringValue = "Hello ";
        [DataMember]
        public bool BoolValue
        {
            get { return boolValue; }
            set { boolValue = value; }
        }
        [DataMember]
        public string StringValue
        {
            get { return stringValue; }
            set { stringValue = value; }
        }
    }
    [DataContract]
    public class Employee
    {
        private string _firstname;
        private string _lastName;
        [DataMember]
        public string Firstname
        {
            get { return _firstname; }
            set { _firstname = value; }
        }
        [DataMember]
        public string LastName
        {
            get { return _lastName; }
            set { _lastName = value; }
        }
    }
}


 Note - Don't forget to include the below line

 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class Service1 : IService1
{

The attribute AspNetCompabilityRequirements is used for specifying an ASP.NET compatible environment for WCF service execution.


and my config file looks as below

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="WcfService1.Service1" behaviorConfiguration="ServerBehave">
        <endpoint address="soapService" binding="basicHttpBinding" contract="WcfService1.IService1"></endpoint>
        <endpoint address="XMLService" binding="webHttpBinding" behaviorConfiguration="restPoxBehaviour" contract="WcfService1.IService1"></endpoint>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServerBehave">
          <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    <endpointBehaviors>
      <behavior name="restPoxBehaviour">
        <webHttp helpEnabled="true"/>
      </behavior>
    </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>
Using JQuery,We can read the JSonResponse from WCF service and below is the client side code for reading RESTful wcf in JQuery

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html src="http://code.jquery.com/jquery-1.7.js">
<head>
    <script src="http://code.jquery.com/jquery-1.7.js"></script>
    <title>jQuery calling RESTful Services</title>
    <meta xmlns="http://www.w3.org/1999/xhtml" content="text/html; charset=utf-8" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
 function getDataFromWCF() {
            $.ajax(
               {
                   type: "GET",
                   url: "http://localhost:58408/Service1.svc/XMLService/getShreekData",
                   data: {},
                   contentType: "application/json; charset=utf-8",
                   dataType: "json",
                   success: function (response) {
                       var output = "<ul>";
                       for (var i in response) {
                           output += "<li>" + response[i].Firstname + " " + response[i].LastName;
                       }
                       output += "</ul>";
                       document.getElementById("Div1").innerHTML = output;
                   },
                   error: function (XMLHttpRequest, textStatus, errorThrown) {
                       try {
                           alert(JSON.stringify(XMLHttpRequest) + "\n" + textStatus + "\n" + errorThrown);
                       }
                       catch (ex) { }
                       finally { }
                   }
               });
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
         
            <input type="button" onclick="getDataFromWCF()" name="Button1" value="Button2" />
            <div id="Div1"></div>
        </div>
    </form>
</body>
</html>

Output looks as below


 

Reading C# object array in JQuery


Below is the code snippet which will help you read the C# object collection on client client using JSon parsing.

Server side code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;
/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService
{
    public WebService()
    {
        //Uncomment the following line if using designed components
        //InitializeComponent();
    }
 [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public List<Lad> GetData()
    {
        //Perform operations on List of classroom objects
        return new List<Lad>
        {
            new Lad {
                firstName = "Shreekanth",
                lastName = "Gaanji",
                dateOfBirth = new MyDate
                {
                    year = 1985,
                    month = 12,
                    day = 08
                }
            },
             new Lad {
                firstName = "Mahantesh",
                lastName = "Kendhuli",
                dateOfBirth = new MyDate
                {
                    year = 1983,
                    month = 06,
                    day = 05
                }
            },
             new Lad {
                firstName = "Manjunath",
                lastName = "Murgod",
                dateOfBirth = new MyDate
                {
                    year = 1983,
                    month = 09,
                    day = 07
                }
            }
            ,
             new Lad {
                firstName = "Sandeep",
                lastName = "Patil",
                dateOfBirth = new MyDate
                {
                    year = 1986,
                    month = 08,
                    day = 05
                }
            }
        };
    }
    public class MyDate
    {
        public int year;
        public int month;
        public int day;
    }
    public class Lad
    {
        public string firstName;
        public string lastName;
        public MyDate dateOfBirth;
    }
}

Client side code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html src="http://code.jquery.com/jquery-1.7.js">
<head>
    <script src="http://code.jquery.com/jquery-1.7.js"></script>
    <title>jQuery calling RESTful Services</title>
    <meta xmlns="http://www.w3.org/1999/xhtml" content="text/html; charset=utf-8" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
 function getData() {
            $.ajax(
                {
                    type: "POST",
                    url: "WebService.asmx/GetData",
                    data: {},
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (response) {
                        var output = "<ul>";
                        for (var i in response.d) {
                            output += "<li>" + response.d[i].firstName + " " + response.d[i].lastName + " " + response.d[i].dateOfBirth.year + "/" + response.d[i].dateOfBirth.month + "/" + response.d[i].dateOfBirth.day
                        }
                        output += "</ul>";
                        document.getElementById("abc").innerHTML = output;
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        try {
                            alert(JSON.stringify(XMLHttpRequest) + "\n" + textStatus + "\n" + errorThrown);
                        }
                        catch (ex) { }
                        finally { }
                    }
                });
        }
 </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <input type="button" onclick="getData()" name="Button1" value="Button1" />
            <div id="abc"></div>
 </div>
    </form>
</body>
</html>

Here is the OutPut

 

Thursday, May 23, 2013

Reading JavaScript object in C# using JQuery


Today i got some free time and thought of making my hands dirty in JQuery and here is the result of it :)

Below is the code snippet which uses JQuery to read C# object list from a web Method and displays in a list.

Server Side code

/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService
{
    public WebService()
    {
        //Uncomment the following line if using designed components
        //InitializeComponent();
    }
    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public void GetEmployees(List<Employee> employees)
    {
        //Perform operations on List of employee objects
        foreach (Employee c in employees)
        {
            //c.Id
            //c.Name
            //c.Role
        }
    }

public class Employee
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Role { get; set; }
    }
}


Client Side Code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html src="http://code.jquery.com/jquery-1.7.js">
<head>
    <script src="http://code.jquery.com/jquery-1.7.js"></script>
    <title>jQuery calling RESTful Services</title>
    <meta xmlns="http://www.w3.org/1999/xhtml" content="text/html; charset=utf-8" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
      
        function PostJSONObjectToServer() {
            var JSONObject = new Array();
            var obj = new Object();
            obj.Id = 0;
            obj.Name = "Shreekanth"
            obj.Role = "Sr.Developer";
            JSONObject.push(obj);
            var obj = new Object();
            obj.Id = 1;
            obj.Name = "Mahantesh"
            obj.Role = "Sr.Developer";
            JSONObject.push(obj);
            var obj = new Object();
            obj.Id = 2;
            obj.Name = "Manjunath"
            obj.Role = "Sr.Developer";
            JSONObject.push(obj);
            var obj = new Object();
            obj.Id = 3;
            obj.Name = "Pramod"
            obj.Role = "Sr.Developer";
            JSONObject.push(obj);
            var obj = new Object();
            obj.Id = 4;
            obj.Name = "Ravi"
            obj.Role = "Sr.Developer";
            JSONObject.push(obj);
            $.ajax(
                {
                    type: "POST",
                    url: "WebService.asmx/GetEmployees",
                    data: JSON.stringify({ employees: JSONObject }),
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (response) { }
                });
        }
</script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <input type="button" onclick="PostJSONObjectToServer()" name="Button1" value="Button1" />
 </div>
    </form>
</body>
</html>

Note -
1. Please don’t forget to uncomment this line[System.Web.Script.Services.ScriptService]2. The parameter name and Json object name should match.