mobile:regularExpressionValidator

mattispro

New Member
Hello,<BR><BR>I am building a mobile app for demo purposes. Everything works fine, except for the regularExpressionValidator. I am using the Microsoft Mobile Internet Toolkit, VS.NET, and the Nokia Simulator Application 2.0. The validation does not seem to do anything at all. I also ran the ASPX page in a browser with the same results (no results). Any help greatly appreciated. Here is the relevant code:<BR><BR>----------stuff at the top------------<BR><%@ Import Namespace="System" %><BR><%@ Import Namespace="System.Data" %><BR><%@ Import Namespace="System.Data.OleDb" %><BR><%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" Language="VB" %><BR><%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %><BR><BR><BR>----------the method in question------------<BR> sub cmdNewEntry_OnClick(sender as object, e as eventArgs)<BR> if page.isValid then<BR> dim strFName as string = txtFName.Text<BR> dim strLName as string = txtLName.Text<BR> dim strDispName as string = txtDName.Text<BR> dim strPhone as string = txtPhone.Text<BR> dim objConn as new oleDbConnection(configurationSettings.appSettings("contactsConn"))<BR> objConn.Open()<BR> dim strSQL as string = "INSERT INTO tblContacts (UserId, firstName, lastName, displayName) " & _<BR> "VALUES(" & session("Login") & ", '" & strFName & "', '" & strLName & "', '" & strDispName & "')"<BR> dim objCmd as new oleDbCommand(strSQL, objConn)<BR> <BR> if session("Login") < 1 then session("login") = 1<BR> <BR> dim i as integer<BR> i = objCmd.ExecuteNonQuery()<BR> objCmd = new oleDbCommand("SELECT @@IDENTITY", objConn)<BR> dim lngNewID as Int64 = clng(objCmd.ExecuteScalar)<BR> strSQL = "INSERT INTO tblPhone (ContactID, Phone) VALUES (" & lngNewID & ", '" & strPhone & "')"<BR> objCmd = new oleDbCommand(strSQL, objConn)<BR> i = objCmd.ExecuteNonQuery()<BR> objConn.Close()<BR> objConn = Nothing<BR> activeForm = frmMenu<BR> else<BR> activeForm = frmBad<BR> end if<BR> end sub<BR><BR>-----------the form in question----------------<BR><mobile:Form id="frmAddEntries" runat="server"><BR> <mobile:Label runat="server" styleReference="Title" text="F_Name:"/><BR> <mobile:TextBox id="txtFName" runat="server" size="10" Text="John"/><BR> <mobile:Label runat="Server" styleReference="Title" text="L_Name:"/><BR> <mobile:TextBox id="txtLName" runat="server" size="10" Text="Smith"/><BR> <mobile:Label runat="server" styleReference="Title" text="Display:"/><BR> <mobile:TextBox id="txtDName" runat="Server" size="10" text="Smitty"/><BR> <mobile:Label runat="Server" styleReference="Title" text="Phone:"/><BR> <mobile:TextBox id="txtPhone" runat="server" size="10" /><BR> <mobile:RegularExpressionValidator id="regExpPhone" runat="server" ControlToValidate="txtPhone" ValidationExpression="^((\(\d{3}\) ?)&#124(\d{3}-))?\d{3}-\d{4}$" ErrorMessage="Phone Number Invalid" /><BR> <mobile:Command id="cmdNewEntry" runat="server" OnClick="cmdNewEntry_OnClick" alignment="center"><BR> OK<BR> </mobile:Command><BR></mobile:Form><BR>
 
Back
Top