Saturday, March 10, 2012

ASP.Net AJAX application to check use avability

This program is for check whether a username is already taken or not. Copy and paste below code into a AJAX enable ASP.Net page and edit database connection section according to your database setting.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="user_check.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<html xmlns="" >
<head runat="server">
    <title>Untitled Page</title>
<style type="text/css">
.waitingdiv {
background-color: #F5F8FA;
border: 1px solid #5A768E;
color: #333333;
font-size: 93%;
margin-bottom: 1em;
margin-top: 0.2em;
padding: 8px 12px;
width: 8.4em;
    <form id="form1" runat="server">
    <asp:ScriptManager ID="scriptmanager1" runat="server">

<script type="text/javascript">
function BeginRequestHandler(sender, args) {
var state = document.getElementById('loadingdiv').style.display;
if (state == 'block') {
document.getElementById('loadingdiv').style.display = 'none';
} else {
document.getElementById('loadingdiv').style.display = 'block';
args.get_postBackElement().disabled = true;

<asp:UpdatePanel ID="PnlUsrDetails" runat="server">
<asp:TextBox ID="txtUsername" runat="server" AutoPostBack="true" ontextchanged="txtUsername_TextChanged"/>
<div id="checkusername" runat="server"  visible="false">
<asp:Image ID="imgstatus" runat="server" Width="17px" Height="17px"/>
<asp:Label ID="lblStatus" runat="server"></asp:Label>
<div class="waitingdiv" id="loadingdiv" style="display:none; margin-left:5.3em">
<img src="LoaderClockIcon.gif" alt="Loading" style="height: 30px" />Please wait...


No comments:

Post a Comment