Skip to main content


Natural Sorting in

In this post,I will show you how to implement natural sorting in are several ways to implement this,but in this post,I am going to use windows api.
Check out following link for more detailsStrCmpLogicalW (shlwapi)
Let's start the implementation

Create a new class named FileList and add following code

Create a new class in App_Code folder and add following code

Here is complete source codeFileList.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; publicclass FileList { public FileList() { } publicstring Name { get; set; } public DateTime DateModified { get; set; } publicstring FileType { get; set; } publicstatic List<FileList> List { get { returnnew List<FileList> { new FileList{Name="file11.txt",DateModified=DateTime.Now,FileType="Text"}, new FileList{Name="file1.txt",DateModified=DateTime.Now,FileType="Text"}…

How to implement bubble sort in c#

In this post,I am going to show you how to implement bubble sorting in c#.
What is Bubble Sort
Bubble sort, is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order.

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SortingDemo { publicclass BubbleSort { publicvoid BubbleSort() { //Initialize array dataint[] data = { 5, 3, 6, 1, 8, 7, 2, 4 }; for (int outerIndex = 0; outerIndex < data.Length; outerIndex++) { for (int innerIndex = 0; innerIndex < data.Length-1; innerIndex++) { if (data[innerIndex] > data[innerIndex+1]) { //swap data. Swap(data, innerIndex); } } } } privatestaticvoid Swap(int[] dat…

Calling cross domain wcf service using Jquery

In this post,I will show you how to call cross domain service using jquery.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.Serialization; using System.ServiceModel; using System.IO; using System.ServiceModel.Web; using System.Runtime.Serialization.Json; namespace CorssDomainService { [DataContract] publicclass Order { [DataMember] publicint ID { get; set; } [DataMember] public DateTime OrderDate { get; set; } [DataMember] publicstring Name { get; set; } } [ServiceContract] publicinterface IOrderService { [OperationContract] [WebInvoke(Method = "GET", UriTemplate = "/", ResponseFormat = WebMessageFormat.Json )] string ProcessOrder(); } [ServiceBehavior] publicclass OrderService : IOrderService { [OperationBehavior] publicstring ProcessOrder() { …

How to submit(Post) a webfrom from python/IronPython

In this post,I am going to show you how to post data from python to a webfrom from python. import urllib.parse import urllib.request url='' values={'keyword':'Void', 'data':'aspdotnetcodebook' } data=urllib.parse.urlencode(values) binary_data = data.encode('utf-8') req=urllib.request.Request(url,binary_data) response=urllib.request.urlopen(req) print (the_page)

How to create self signed certificate using makecert

In this post,I will show you how to create self signed certificate for wcf application.For this,I will used the utility makecert.MakeCert.exe allows you to (for test/dev purposes) generate both a trusted root certificate and a certificate signed by that trusted root certificate for encryption purposes (also for signature purposes.
Open visual studio command prompt (Admin mode) and type following command 
C:\cert>makecert -pe -n "CN=RootCA" -ss My -sr LocalMachine -a sha1 -sky signatu re -r "RootCA.cer" -pe Marks the generated private key as exportable. This allows the private key to be included in the certificate.-Specifies the subject's certificate name. This name must conform to the X.500 standard. The simplest method is to specify the name in double quotes, preceded by CN=; for example, "CN=myName".-ss Specifies the subject's certificate store name that stores the output >localmachine-a Specifies the signature algorithm…

How to validate form using Jquery

In this post I will show you how to validate form using jqery. Create a new website,add a new js file ,and add following code inside it function validateForm(e) { var formIsValid = true; // check that a valid email address has been entered var emailRegExp = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/; if (!emailRegExp.test(String($("#txtEmail").val()).toUpperCase())) { addError("txtEmail", "Please enter a valid email address."); formIsValid = false; } else { removeError("txtEmail"); } // check that first name has one or more characters if ($("#txtFirstName").val() == '') { addError("txtFirstName", "This field is required."); formIsValid = false; } else { removeError("txtFirstName"); } // check that last name has one or more characters if ($("#txtLastName").val() == '') { …

How to enable/disable dropdownlist through a checkbox selection

In this post,I will show you how to enable/disable dropdownlist control through checkbox selection in

Create a new website Right click on the website,add a new webpage,and add following code into it

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"""><htmlxmlns=""><headrunat="server"><title></title><scriptsrc="Scripts/jquery-1.4.1.js"type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $("#chkEnable").click(function () { if (this.checked) $('#ddlList').attr('disabled', 'disabled');���������������…