Handling MaskEditValidator suceeds or failed event in code behind and in client side

Hi,

When I use MaskEditValidator along with a maskedit ajax control. I need to trap the event when validation has taken place to check if it suceeded or it failed in order to implement some logic. I want to do that in both client side and code behind. Can u please tell me how? if it s only possible in one place (client or code behind), can u tell me how?

Thank you. 


Thanks a lot, I appreciate your taking the time to help me.
0
tutus
6/28/2008 5:26:25 PM
asp.net.ajax_control_toolkit 17816 articles. 1 followers. Follow

2 Replies
971 Views

Similar Articles

[PageSpeed] 49
Get it on Google Play
Get it on Apple App Store

Hi tutus,

To handle whether the input value is valid or not, please refer to this code: 

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="TestMaskDate.aspx.vb"
    Inherits="SoluTest_CalendarUserControl.TestMaskDate" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <strong>To handle whether the input value is valid or not.<br />
            Enter Number (format:999 <em>Min:200/Max:500</em>):</strong>
        <br />
        <asp:TextBox ID="TextBox3" runat="server" onblur="textOnBlur()" onkeypress="textOnKeyPress()"
            onkeydown="textOnKeyPress()" />
        <ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender3" runat="server" TargetControlID="TextBox3"
            Mask="999" AutoComplete="False" MaskType="number" ClearMaskOnLostFocus="true" />
        <ajaxToolkit:MaskedEditValidator ID="MaskedEditValidator3" runat="server" ControlExtender="MaskedEditExtender3"
            ControlToValidate="TextBox3" EmptyValueMessage="please insert a value" ErrorMessage="invalid value"
            InvalidValueMessage="you have insert an invalid value" MinimumValue="200" MinimumValueMessage="min"
            MaximumValueMessage="max" MaximumValue="500" />
    </div>
    <asp:Label ID="lblDisplay" runat="server" Text="State"></asp:Label>
    </form>

    <script language="javascript" type="text/javascript">
   
    function textOnBlur(){    
        $find("MaskedEditExtender3")._InLostfocus = true;
        var IsValid = $find("MaskedEditExtender3")._PeforformValidLostFocus(true);
        handleIsValid(IsValid);
    }
    
    function textOnKeyPress(){
        if (event.keyCode == 13) {
            var IsValid = $find("MaskedEditExtender3")._PeforformValidLostFocus(false);
            handleIsValid(IsValid);
        }    
    }
    
    function handleIsValid(IsValid){
        if (IsValid)
        {   
            $get("lblDisplay").innerText="Valid";
        }
        else
        {
            $get("lblDisplay").innerText="Invalid";
        }
    }
    </script>

</body>
</html>
This code could work in IE currently, you may modify it to fit the other browsers.For more information, please refer to the original design code in the MaskedEditBehavior.js file(function _onBlur &  _onKeyPress &_onKeyPressdown)
.
If I have misunderstood you, please let me know.

Best regards,

Zhi-Qiang Ni


Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
Answer” if a marked post does not actually answer your question.
0
Zhi
7/7/2008 1:56:55 AM

 

that answers my question a bit. thanks. can we do those tests on the server side?

Thanks


Thanks a lot, I appreciate your taking the time to help me.
0
tutus
7/10/2008 1:57:49 PM
Reply:

Similar Artilces:

HANDLING THE SEQUENCE OF CODE BEHIND CODE AND CLIENT SIDE SCRIPTING?
In a form on a page I want to save the data values entered into the varieous server controls, such as RadioButtonLists, TextBoxes, etc. before displaying the saved information in a new page suitable for later print. I have a LinkButton on page1.aspx, whose Click event uses the code behind to save the values into a dataset. The LinkButton also has a OnClientClick then execute the JavaScript on page1.aspx, that simply does a window.open of page2.aspx that uses a different Masterpage from Page1 in order to respect the printing requirements. But!!!!!!! The client side script is executed befor...

Question about client side and code behind code
How is code behind code processed on client side? I ask because I'm trying to figure out a problem I have with a link button in a gridview. If I open the page and run it as normal everything fires fine. I click on the link button and it loads the new page. However if I email the page to myself and click on the link button nothing happens. I do not think that the Gridview_Rowcommand fires. The link button represents a DB ID field and all the code is in the GridView_RowCommand event in the code behind and fires a Server.Transfer at the end to load the new page. I have tried Response.Redi...

Firing both Client side event and server side event for server side button
I am having some difficulties getting this to work.. I have button_click (Asp.net) and ClientClick (Javascript).  Javascript is firing fine.  Server script is not. may be you have return return false in the in the javascript which is why its not firing server side event.You should add javascript evelt like thisbutton1.onclientclick = "functionname" Function should nopt return false. Vikram www.vikramlakhotia.comPlease mark the answer if it helped you...

Calling Button Click Event From Another Event With Client Side Code
Hi All,I am trying to call a (server control) button's click event from another event where the button has a client side code as well. I defined my button as: <asp:Button runat="server" id="button1" onclick="button1_Click" onclientclick="someJSFunction(); return false;" text="..." />  The button1_Click event does not contain any server side code, I just need a reference for my other event to call to, like so: void OtherEvent(object sender, EventArgs e) { button1_Click(sender, e);}  What happens is that button1_Click is being fired but the client side code ...

Client Side validation of Calendar control prior to server side selectionchanged event code
Hello, Any thoughts or suggestions regarding this will be greatly appreciated. I have a Calendar control with the validation constraint(can't enter appointments on Holidays or on Thursdays). To create a smoother experience, I'd like for this to be done client side. The dillema is how can I intercept or precede the <asp:calendar> controls selectionchanged event from firing and run my client javascript; passing it to the server if validation succeeds for more intensive processing and database activity. The clientside javascript will need the selected date to deter...

Atlas client side control value available to server side C# code behind
I have an existing ASP.NET application. The page contains a datagrid (asp:datagrid). In my current C# code behind, I fetch data from SQL Server 2005 and bind to the datagrid when a button is selected (Click event). There can be many entires in the grid however, so the user typically enters text in a textbox as a filter on the returned results from SQL Server 2005. Now after studying an Atlas sample animalservice http://atlas.asp.net/docs/atlas/doc/data/default.aspx, with an HTML suggestion text box, I would like to use client-side Atlas to give the user a better indication of...

Calling a sever side code behind sub routine from client side java script
Hi is it possible to call a server side sub routine from client side javascript what I what to do is call a form based email routine from the client, I am hoping that by doing it this way I can disable the button used to call the routine imeadiatly so it's only possible to click it 1 time to prevent the same email being send multiple times, and in addtion start a client routine to indicate the email is underway with some graphic of some sort so the use knows that something is happening, all this is because if the attacment is quite large it takes a little while for the procees to...

client side code & server side code
what is the difference between client side coding & server side coding ? when to use client side & server side code? Client side code runs on the user's browser and includes languages such as javascript and vbscript. Server side code runs on the web server and can be written in languages such as ASP.NET, PHP, ASP, ColdFusion etc. Website Design Darlington - http://mdssolutions.co.ukhttp://lessthandot.com - Experts, Information, Ideas & Knowledgehttp://aspnetlibrary.com - An online resource for professional ASP.NET developersPlease remember to click "Mark as Answer...

client side event handling
i want to use a windows .net control in a web page.and want to handle the events at client endi got the following code from http://support.microsoft.com/kb/555687but its not working for meevent handling ------------------<script for=myControl1 event="event1" language="javascript"> function myControl1::event1 { alert('my messge'); } </script>   placing the control on web page--------------- <form id="Form1" method="post" runat="server"> <OBJECT id="mycontrol1" style="WIDTH: 416px; HEIGHT: 288px" height="288" width="416" c...

Client side event handling
I have the following function on a client side event for when a button in the detail view of a webdatawindow is clicked. This works fine, but is not much use. function WebDataWindowControl1_Clicked(sender, rowNumber, objectName) { if(objectName=="b_call") { confirm("You clicked the " + objectName + " column in row " + rowNumber) } } What I want to do is add some data to the confirm message. From the example I have seen on code exchange I should be able to add the following ...

"Push" messages to Atlas/Ajax Client or Client-side event handling of server messages
What I'm looking for is the ability for the client-side Ajax/Atlas GUI to be able to update itself when events occur on the server. The issue is that the events are triggered from a third party, and aren't triggered by postback. For example, let's say there's a Queue of data on the server, and each time a new item is added to the Queue, I want the client to recognize the addition and display the new item. Right now, the only way I can think of doing this is by setting up an Ajax timer and checking the state of the Queue on every timer tick. While this doesn't cause the page to refresh/postba...

Help with client side events Vs. server side events
Hi, Can someone look as the following script and tell me why marking the check box doesn't generate a client side event eventhough there's: onclick="checkClick()"? marked.  Thanks in advance, Sivan <%@ Page Language="c#" %><HTML> <HEAD>  <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body>  <SCRIPT language="c#" runat="Server">  void Page_Load(object s, EventArgs e) {  if (!Page.IsPostBack)  {   Label1.Text = Label...

How to handle server events on client side?
Hi, I would please like to know how a server application can update a browser web client on an intermittent basis without the need for polling by the client? Is it also possible to update only specific clients? Thanks.        First part of the question, there is no way a server can indpendantly initiate a communication back to the client. Remember - http is a connectionless stateless protocol. Unless you have a client that uses a protocol other than http ( socket based connections for eg: using flash socket api) there is no way you can do this. Having s...

XML
I have a need to manipulate an xml file within my code behind pages and after doing that to pass it across so that I can use some javascript routines on it. It should work like this: 1. Web page receives a request which contains an xml file. 2. xml file is extracted and validated/checked in the code behind. 3. xml file then needs to be manipulated using javascript. I know that all that we need can be done using code behind but I need to create a javascript file that can be used by the sender of the xml to perform some functions before it gets posted. Has anyone got any ideas o...

Web resources about - Handling MaskEditValidator suceeds or failed event in code behind and in client side - asp.net.ajax_control_toolkit

Resources last updated: 11/21/2015 7:51:50 AM