用户控件中的 Ajax控件、用户、Ajax

2023-09-07 15:38:30 作者:﹏小心、Mie伱全家

我有一个注册页面,我想用 ajax 检查用户名是否存在

i have a signup page and i want to check username exists or not with ajax

 <%@ Control Language="C#" AutoEventWireup="true" CodeFile="Simple.ascx.cs" Inherits="UserControls_Simple" %>
<div style="direction:rtl;">
<table style="font-family:Tahoma;font-size:12px;width:200px;">
<tr>
<td>نام کاربری:</td>
<td><asp:TextBox ID="txtUserName" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
    <asp:Label ID="lblMessage" runat="server" Text="Username Already Exists" Visible="False"></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td>کلمه عبور</td>
<td><asp:TextBox ID="txtPassword" runat="server"></asp:TextBox></td>
</tr>
</table>
</div>

如果用户存在,我想显示标签

i want to show label if user exists

我该怎么做?

推荐答案

使用 Ajax 通过用户控件(或您使用的任何方法)检查​​数据库中是否存在用户与您在 Web 中使用的方法相同页.

Using Ajax to check if a user exists in your DB via a User Control (or whatever method you are using) is the same method you would use in a Web Page.

您想使用哪种 Ajax?MS Ajax,jQuery,什么?

What kind of Ajax do you want to use? MS Ajax, jQuery, what?

无论如何,您都需要从客户端脚本调用 Web 服务 执行 AJAX 请求.

Regardless, you will need to Call Web Services from Client Script to perform an AJAX request.