Skip to main content


Showing posts from 2010

jQuery Image Swap with Effects

Swapping one image with another is probably one of the most used javascript techniques. Also Dreamweaver made “Image Replacement” even easier for non HTML/Javascript programmers by including this feature out of the box. One thing about Dreamweaver’s image swapping javascript is that it’s not the most beautiful javascript code. Well, as always with anything javascript related, jQuery is to the rescue. Query makes dynamic image swapping a peace of cake.
Firstly you have to copy the following javascript code in the HEAD section of your page. You can also save the following javascript functions in a seperate js file.

(function($) { $.fn.innerfade = function(options) { return this.each(function() { $.innerfade(this, options); }); }; $.innerfade = function(container, options) { var settings = { 'animationtype': 'fade', 'speed': 'fast', 'type': …

SQL Bulk Copy with C#.Net

Bulk copying of data from one data source to another data source is a new feature added to ADO.NET 2.0. Bulk copy classes provides the fastest way to transfer set of data from once source to the other. Each ADO.NET data provider provides bulk copy classes. For example, in SQL .NET data provider, the bulk copy operation is handled by SqlBulkCopy class, which is described in Figure 1. As you can see from Figure 1, data from a data source can be copied to one of the four types - DataReader, DataSet, DataTable, or XML.

Figure 1. Bulk Copy operation in ADO.NET 2.0
Using bulk copy operation, you can transfer data between two tables on the same SQL Server, between two different SQL Servers, or even two different types of database servers.

using System.Data.SqlClient; public static void CopyData(DataTable sourceTable, SqlConnection destConnection, SqlTransaction destTrans, string destTableName) { // new method: SQLBulkCopy: using (SqlBulkCopy s = new SqlBulkCopy(destConnec…

ASP.NET DropDownList with OptionGroup support

ASP.NET 2.0, for all its bells and whistles, lacks the odd bit of functionality for reasons completely unknown. One such notable omission is that of OptionGroup (<optgroup>) support in the DropDownList control. For those unfamiliar with the <optgroup> element, it is part of the XHTML standard, and has the effect of categorising items in a <select>, as the following image shows.

Control Adapters are new in ASP.NET 2.0, and allow the developer to override the rendering behavior of any control, very powerful stuff! Furthermore, Control Adapters are used in conjunction with a browser file, so specific browsers may be targeted, if required. Armed with that knowledge, the solution became simple. The attached download contains the requisite files to implement this solution in your own projects, but for posterity, I paste it here also.
public class DropDownListAdapter : System.Web.UI.WebControls.Adapters.WebControlAdapter { protected override void RenderContents(Ht…

Configure IP Address and Other Network Information in Windows 7

Configure IP Address and Other Network Information in Windows 7
Let me show you how to configure IP address and other network information in Windows 7 here. As you know IP address must be configured on computer in order to communicate with other computers, because this IP address is the standard address understood by computers and other networking devices in networking world. You can configure IP address, subnet mask, gateway and DNS servers manually on computer, but you can also configure computer to obtain IP address and other network information from DHCP server (most of the time is configured on router).
Without wasting any more time, let me show you quick way to do it:
1) Go to Start and click on Control Panel.
2) Proceed to click View network status and tasks in Control Panel window.

3) Network and Sharing Center window will appear, then click change adapter settings.

4) Network Connections window will appears. Here you can right click on the network adapter (can be wireless adapte…

Running 32-bit Server Applications on 64-bit Machines

Running 32-bit Applications on 64-bit Windows (IIS 6.0)
Windows Server 2003™, Service Pack 1 enables IIS 6.0 to run 32-bit Web applications on 64-bit Windows using the Windows-32-on-Windows-64 (WOW64) compatibility layer. IIS 6.0 using WOW64 is intended to run 32-bit personal productivity applications needed by software developers and administrators, including 32-bit Internet Information Services (IIS) Web applications. On 64-bit Windows, 32-bit processes cannot load 64-bit DLLs, and 64-bit processes cannot load 32-bit DLLs. If you plan to run 32-bit applications on 64-bit Windows, you must configure IIS to create 32-bit worker processes. Once you have configured IIS to create 32-bit worker processes, you can run the following types of IIS applications on 64-bit Windows: •Internet Server API (ISAPI) extensions •ISAPI filters •Active Server Page (ASP) applications (specifically, scripts calling COM objects where the COM object can be 32-bit or 64-bit) •ASP.NET applications IIS can, by default…

Show Current Time via JavaScript

This Code will show client side current time. 
You just have create a div with a JavaScript function call as shown below.

JavaScript Function:

function js_clock() { var clock_time = new Date(); var clock_hours = clock_time.getHours(); var clock_minutes = clock_time.getMinutes(); var clock_seconds = clock_time.getSeconds(); var clock_suffix = "AM"; if (clock_hours > 11) { clock_suffix = "PM"; clock_hours = clock_hours - 12; } if (clock_hours == 0) { clock_hours = 12; } if (clock_hours < 10) { clock_hours = "0" + clock_hours; } if (clock_minutes < 10) { clock_minutes = "0" + clock_minutes; } if (clock_seconds < 10) { clock_seconds = "0" + clock_seconds; } var clock_div = document.getElementById('js_clock'); clock_div.innerHTML = "<strong>" + clock_hours + &qu…

LOCK in SQL Server

In SQL Server 2000 (Enterprise Manager)
1. Expand server – management-current Activity-expand Locks/processid and you will be able to see all the locks related information.
2. Expand server – management-current Activity-expand Locks/object you can see locks by object information.
In SQL Server 2005 (SSMS, object Explorer)
Expand-server-management-double click Activity Monitor.
On left side you have three options to choose from, select those options and you can see all the locks related information.
Run this stored procedure in the database.
1. sp_lock
To know the running process in the sql server, run this query,
2. select*from sysprocesses(in sql server 2000) 3.

Max Length not working for Multi Line Text Box : Solution

In almost all the web projects, we require a multiline TextBox control. It was annoying to find that maxLength property doesn't work on multiline textboxes. There is a workaround to accomplish this using RegularExpressionValidator. Following is the markup that will restrict the text box to maximum of 500 characters.

OR You it can be done so easily using javascript functions.

I suggest that we should put a javascript validator function so that user will not be able to enter characters more than the length specified, even cant paste any text with more than specified characters. Here are those javascript functions.

TextBox Control


// Keep user from entering more than maxLength characters function doKeypress(control){ maxLength = control.attributes["maxLength"].value; value = control.value; if(maxLength && value.length > maxLength-1){ event.returnValue = false; maxLength = parseInt(maxLength); } }

// Cancel default…