Shengwen Blog

Break it down, make it simple.

SQL Server deadlocks

Catalog How SQL Server detects deadlock? Deadlock Priority What is the deadlock victim selection criteria? Logging deadlock Handling deadlocks in ado.net How SQL Server detects deadl...

Create a custom .NET exception

Create a class that derives from System.Exception class. As a convention, end the class name with Exception suffix. All .NET exceptions end with,  exception suffix. If you don’t do so, you won’t...

Auto phone format JavaScript implementation

JavaScript code to change the phone number in textbox to (XXX)XXX-XXXX format immediately

In the HTML, add a textbox as below: 1 <input type="text" runat="server" Width="210px" maxlength="13" onkeydown="javascript:backspacerDOWN(this,event);" onkeyup="javascript:backspacerUP(this,eve...

SOAP and RESTful: Which to choose?

Differences and tips of choosing web services

What are the differences between both SOAP WS and RESTful WS? The SOAP WS supports both remote procedure call (i.e. RPC) and message oriented middle-ware (MOM) integration styles. The Restful Web ...

Set a default name for files that will be downloaded by users

Sometimes we need to generate files dynamicly and let the users ro download these files when running the web app. The users may want our app to generate a default file name to make it easy for them...

Set a default name for files that will be downloaded by users

Sometimes we need to generate files dynamicly and let the users ro download these files when running the web app. The users may want our app to generate a default file name to make it easy for them...

Prevent a search box from being submitted without entering any text

Test blog

Simple code to prevent a search box from being submitted without entering any text. Listen to the submit event of the form and stop the event if there is no text in the search box. Create a js file...