[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.mobile

MobileControls Validator's not working

(Steve)

12/25/2002 3:31:00 PM

Someone please help, I am having trouble with getting the Validator's
to work in a mobile client. This is my code and it doesn't make any
sense.

For the range control, if I enter in the value 7 it doesn't except it
and say's that the value is out of range, however if I enter in the
value 12 it works correctly.

For the required validator, if I do not enter in any value whatsoever
it also does not work correctly.

Am I making some obvious mistake?

aspx

<%@ Page language="c#" Codebehind="AddHourEntry.aspx.cs"
Inherits="MobileHusky.AddHourEntry" AutoEventWireup="false"
smartNavigation="False" %>
<%@ Register TagPrefix="mobile"
Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
%>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="http://schemas.microsoft.com/Mobile/...
name="vs_targetSchema">
<body Xmlns:mobile="http://schemas.microsoft.com/Mobile/WebForm...
<mobile:form id="AddHourEntryForm" runat="server"
BackColor="AliceBlue">
<mobile:Label id="lblDate" runat="server">Date </mobile:Label>
<mobile:Label id="lblProject" runat="server">Project</mobile:Label>
<mobile:Label id="lblRole" runat="server">Role</mobile:Label>
<mobile:Label id="lblHours" runat="server">Hours</mobile:Label>
<mobile:TextBox id="txtHours" runat="server"
Numeric="True"></mobile:TextBox>
<mobile:Command id="cmdOk" runat="server"
Alignment="Right">Ok</mobile:Command>
<mobile:Command id="cmdCancel" runat="server"
Alignment="Right">Cancel</mobile:Command>
<mobile:RangeValidator id="vldHoursRange" runat="server"
Alignment="Left" Wrapping="NoWrap" ControlToValidate="txtHours"
MinimumValue="0" MaximumValue="24"
ErrorMessage="Range">Range</mobile:RangeValidator>
<mobile:RequiredFieldValidator id="vldRequiredHours" runat="server"
Alignment="Left" Wrapping="NoWrap" ControlToValidate="txtHours"
ErrorMessage="Required">Required</mobile:RequiredFieldValidator>
</mobile:form>
</body>


aspx.cs

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Mobile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.MobileControls;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace MobileHusky
{
/// <summary>
/// Summary description for AddHourEntry.
/// </summary>
public class AddHourEntry : System.Web.UI.MobileControls.MobilePage
{
protected System.Web.UI.MobileControls.RangeValidator vldHoursRange;
protected System.Web.UI.MobileControls.Command cmdOk;
protected System.Web.UI.MobileControls.TextBox txtHours;
protected System.Web.UI.MobileControls.Label lblHours;
protected System.Web.UI.MobileControls.Label lblRole;
protected System.Web.UI.MobileControls.Label lblProject;
protected System.Web.UI.MobileControls.Label lblDate;
protected System.Web.UI.MobileControls.Form AddHourEntryForm;
protected System.Web.UI.MobileControls.RequiredFieldValidator
vldRequiredHours;
protected System.Web.UI.MobileControls.Command cmdCancel;

private void Page_Load(object sender, System.EventArgs e)
{

}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.cmdOk.Click += new System.EventHandler(this.cmdOk_Click);
this.cmdCancel.Click += new
System.EventHandler(this.cmdCancel_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void cmdCancel_Click(object sender, System.EventArgs e)
{
// this.AddHourEntryForm.MobilePage.RedirectToMobilePage("Hours.aspx");
}

private void SetupSelectionListsDateSets()
{

}

private void cmdOk_Click(object sender, System.EventArgs e)
{
double l_duration = Convert.ToDouble(txtHours.Text);
}

}
}

Thanks in advance
Steve