I downloaded Ajax Control Toolkit and want to add its components to my project. I Used ValidatorCallOut Component as an extender of a Textbox and when user changes focus to another Textbox ValidatorCallOut pops up. but this action will cause the page to refresh. How can I prevent that?
Here is my code:<%@ Page Language="C#" MasterPageFile="~/User/UserMasterPage.master" AutoEventWireup="true"
CodeFile="New.aspx.cs" Inherits="User_Accounts_New" Title="Untitled Page" %>
<%@ Register
Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="act" %>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContentPlaceHolder" runat="Server">
<act:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" />
<asp:TextBox ID="LoginUrlTxtb" CssClass="textEntry" TabIndex="0" runat="server" Width="321px"
OnTextChanged="LoginUrlTxtb_TextChanged" AutoPostBack="True"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ErrorMessage="Url is Not Well Formated" ControlToValidate="LoginUrlTxtb">*</asp:RegularExpressionValidator>
<act:ValidatorCalloutExtender ID="RegularExpressionValidator1_ValidatorCalloutExtender"
runat="server" HighlightCssClass="validatorCalloutHighlight"
Enabled="True" TargetControlID="RegularExpressionValidator1"
CssClass="validatorCalloutHighlight" PopupPosition="Left" Width="200px">
</act:ValidatorCalloutExtender>
<asp:TextBox ID="FirstnameTxtb" CssClass="textEntry" TabIndex="开发者_JAVA百科0" runat="server" Width="321px"
OnTextChanged="LoginUrlTxtb_TextChanged" AutoPostBack="True"></asp:TextBox>
</asp:Content>
Your textboxes have the "AutoPostBack"
property set to true. Therefore, whenever they lose focus, they will send a postback to the server and the page will refresh.
精彩评论