ASP. NET automatically detects User Name Registration (using Microsoft Ajax Control Technology)

Source: Internet
Author: User
ASP. NET automatically checks whether the user name is registered (using Ajax technology) (running in IE and Firefox)
Design by hakuci
Code download
The running environment ASP. NET 2.0, Ajax extension package, and sqlserver database can be run only after the development environment is configured. Code .
This code is based on a three-tier architecture

In an empty solution, add a project: model, Dal, BLL, dbutility, and an Ajax-based website project.
Model
Including: Class desingerinfo. CS stores entity classes for data access layer and logic layer calls
Dal data access layer
The desinger. CS class is used to create various data objects. The configuration files and reflection are used here.
Bll business logic layer
Including: desinger. CS Processing Applications Program Is called by the presentation layer.
Dbutility public data access layer
Including: Class sqlhelper. CS to implement specific executereader, executedatatable, executenonquery, etc.
The website project is the presentation layer:
Database Table Structure (this example only uses the first field)

On the "register. aspx" Page, add the updatepanel and updateprogress controls of the textbox and Ajax extensions controls.
For example:

Add control content and Set Properties
Updatepanel content

The updatepanel settings Add the asynchronous send back control bound to the text box. An event occurs when the text is changed.
Updateprogress content

Updateprogress attribute settings bind updatepanel

The running effect is as follows: (run through IE and Firefox)


Code Analysis
/// <Summary>
/// The designer checks whether the registered URL is automatically generated.
/// </Summary>
/// <Param name = "sender"> </param>
/// <Param name = "E"> </param>
Protected void txtname_textchanged (Object sender, eventargs E)
{
Bll. desinger blldata = new desinger (); // create an object
If (blldata. exists (this. txtname. Text. Trim () // you can check whether this user exists.
{
This. lblcheckname. Text = "registration is not allowed! ";
This. lblcheckname. Visible = true;
}
Else
{
This. lblcheckname. Text = "allow registration! ";
This. lblcheckname. Visible = true;
}
This. labelurl. Text = "http: // localhost/DESIGNER/" + this. txtname. text;
}

Code download

Design by hakuci
2008.4.22

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.