Check Username Availability In Using Jquery Ajax

Here we will see how to check for username availability using Jquery Ajax method in In our website we normally keep the username unique and so it must be checked before saving the record that it has not been taken by any other user. We can do this validation on the submit button click or use OnTextChanged event but it is not so user friendly as the page gets Postback.

Following example demonstrates the same using Jquery Ajax method. Here while creating a user account he can check by making an Ajax call to [Web Method] at server side to get the availability of the username. It matches the user input against the database records and returns the text based on the availability. You can modified the code as per your requirements:

Continue reading Check Username Availability In Using Jquery Ajax


Common Table Expression – Sql Server

Here we will see the basics and implementation of CTE in sql server. A common table expression (CTE) is a temporary result set which will be accessible within the next execution scope of a query. The Common Table Expression was introduced in the SQL Server 2005. It basically defines a temporary view which can be referenced in the same query just as a view. A CTE is similar to a derived table but is not stored as an object and lasts only for the duration of the query. Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query.

Syntax of CTE is as follows:

WITH CTEName (Column aliases)
AS (Subquery)
SELECT statement

The select statement must be very next to the CTE and the name is mandatory while the argument is optional.
Continue reading Common Table Expression – Sql Server

Pass DataTable To Store Procedure Using Table Value Parameter.

Here we will see how to pass a datatable as parameter to stored procedure in C# using the sql server user defined table type. One of the way to speed up your application is to reduce the trips to your database especially by avoiding a call to stored procedure multiple times.

Table-valued parameters let you pass a collection of table rows as a parameter to your stored procedure. They allow passing entire sets of rows from ADO.Net code to SQL Server.

Below we will see the steps that needs to be followed to implement this functionality.

Continue reading Pass DataTable To Store Procedure Using Table Value Parameter.

Prevent Cut, Copy And Paste Operation For Text Box In Asp.Net Using Jquery.

Here we will see how to block a user from performing CUT, COPY and PASTE operation on a particular textbox using jQuery. Sometimes it is required to disable the cut copy paste operation and make user mandatory to type the details.

The code is as follows: Continue reading Prevent Cut, Copy And Paste Operation For Text Box In Asp.Net Using Jquery.

Check-Box List Validation In

Here we will see how to validate check box list control in We will use javascript and custom validation to implement this functionality.
The code is as follows:

<html xmlns="">
<head runat="server">
    <script type="text/javascript">
        function CheckboxValidation(sender, args) {
            var checkBoxList = document.getElementById("<%=chk_list1.ClientID %>");
            var checkboxes = checkBoxList.getElementsByTagName("input");
            var isValid = false;
            for (var i = 0; i < checkboxes.length; i++) {
                if (checkboxes[i].checked) {
                    isValid = true;
            args.IsValid = isValid;
    <form id="form1" runat="server">        
            <asp:CheckBoxList runat="server" ID="chk_list1">
                <asp:ListItem Text="Example 1" Value="Example 1"></asp:ListItem>
                <asp:ListItem Text="Example 2" Value="Example 2"></asp:ListItem>
                <asp:ListItem Text="Example 3" Value="Example 3"></asp:ListItem>
                <asp:ListItem Text="Example 4" Value="Example 4"></asp:ListItem>
                <asp:ListItem Text="Example 5" Value="Example 5"></asp:ListItem>
                <asp:ListItem Text="Example 6" Value="Example 6"></asp:ListItem>
            <asp:CustomValidator ID="Checkbox_CustomValidator" runat="server"
                ErrorMessage="One or more checkboxes must be chosen">
            <asp:Button runat="server" ID="btn_submit" Text="Validate" ValidationGroup="CheckBoxValidation" />
            <asp:ValidationSummary runat="server" ID="validateionsummary" ValidationGroup="CheckBoxValidation" ShowMessageBox="true" ShowSummary="false" />

Solution To Request Timed Out Exception

Here we will see how to resolve the “Request Timed Out” issue in web applications. The basic reason for this exception to be thrown is that it exceeds the maximum number of seconds that a request is allowed to execute. Default value for the executionTimeout attribute is 90 seconds. This value can be altered by specifying executionTimeout in <httpRuntime> element under <system.web> section in web.config file. The executionTimeout attribute indicates the maximum number of seconds a request is permitted to run before being terminated by the web application. This error occurs mostly in either uploading large files or if you run a query that takes more than 90 seconds to process.

Following are the steps we need to follow to set the executionTimeout attribute value in the web.config file.

Step 1) Open the web.config file.

Step 2) Add the httpRuntime element in the system.web section.

Step 3) Add executionTimeout attribute to the above added httpRuntime element.

 <httpRuntime executionTimeout="3600" />

[Note : Increase the value of the executionTimeout attribute according to your requirement.]

Step 4) Save web.config file.