MaskedEditValidator not working in MultiView

Posted on 2007-11-21
Last Modified: 2012-05-05
Hello, everyone!

This seems like such a major bug, I am thinking I must be doing something wrong, but I can't figure out what.  I am trying to use some controls with MaskedEditExtenders and MaskedEditValidators inside a MultiView.   In this example the validator is in view A2.  I am OK going from A1 to  A2 and back to A1.  However, the second time I try to switch to A2 I get this error:

Microsoft JScript runtime error: Sys.ArgumentNullException: Value cannot be null.
Parameter name: element

If I remove the MaskedEditValidator I don't get this error.  I am using the latest version of the Ajax Controls Toolkit.  Any ideas?  

<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>


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

<html xmlns="">

<head runat="server">

    <title>Untitled Page</title>



    <form id="form1" runat="server">

        <ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" />


<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" >


  <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0"  >            

     <asp:View ID="A1" runat="server">

          This is view A1


             <asp:TextBox ID="T2" runat="server"></asp:TextBox>


             <asp:TextBox ID="D1012" runat="server"></asp:TextBox>  



      <asp:View ID="A2" runat="server">

          This is view A2


<ajaxToolkit:MaskedEditValidator ID="rfv" runat="server"





            InvalidValueMessage="Phone is invalid"




            <asp:TextBox ID="TextBox1" runat="server" Width="80" CssClass="TextAndNumberFonts"></asp:TextBox>

<ajaxToolkit:MaskedEditExtender ID="maskPhone" Runat="Server"





		 ClearMaskOnLostFocus="False" />



          <asp:TextBox ID="t1" runat="server"></asp:TextBox>




  <br/><br />

     <asp:Button ID="btnPrev2" Text="Previous"  runat="server" OnClick="btnPrev_Click" />

     <asp:Button ID="btnNext2" Text="Next" runat="server" OnClick="btnNext_Click"  />










And the codebehind:


Partial Class _Default

    Inherits System.Web.UI.Page


    Protected Sub btnPrev_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        If MultiView1.ActiveViewIndex = 0 Then

            MultiView1.ActiveViewIndex = MultiView1.Views.Count - 1


            MultiView1.ActiveViewIndex -= 1

        End If

    End Sub


    Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        If MultiView1.ActiveViewIndex = MultiView1.Views.Count - 1 Then

            MultiView1.ActiveViewIndex = 0


            MultiView1.ActiveViewIndex += 1

        End If

    End Sub


End Class

Open in new window

Question by:sophianewbie
  • 4
  • 3
LVL 27

Expert Comment

Comment Utility
This error will only happen in debug mode
stop the debugger and test the script in a browser, you should not see this error
I just ran your code as it is and had no problem with it as long as I am not in debug mode


Author Comment

Comment Utility
I tried it in the browser, but unfortunately, while I don't get the error, the validation doesn't work either.  If you uncheck your Disable Script Debugging option in the browser you will see that the error occurs even when not in debug mode.  It's just ignored if that option if disabled.
LVL 27

Expert Comment

Comment Utility
I dont have disable script debugging disabled and the validation worked fine for me
which version of Ajax and are you using?
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline


Author Comment

Comment Utility
ASP.NET ver.
ASP.NET Ajax ver. 1.0
AjaxControlsToolkit.dll from 9/20/2007
LVL 27

Expert Comment

Comment Utility
Ok that explains it then
I am running VS.Net 2008 and farmework 3.5. I know there are some differences between the 2 versions in Ajax


Author Comment

Comment Utility
Well, we are planning to upgrade to ASP.NET 3.5, but not today :)  So, in the meantime, I'm SOL?
LVL 27

Accepted Solution

Sammy earned 500 total points
Comment Utility
I am sorry but it looks like you are SOL
I dont have VS 2005 to even try anything and I just did a fresh install of windows with only .Net 3.5

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now