Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Money, numeric values
Message
De
15/08/2011 15:14:21
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
15/08/2011 07:13:26
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01520997
Message ID:
01521026
Vues:
34
>Hello. I have an application where the users can input a $0.00 value. I've tried Numeric(10,2) and Money as the data types, but it still says it cannot save the dataset becuase Cost is required. $0.00 is a valid input value.
>
>Thanks.

Per Kevin's instructions you can just change your existing rule.
Rule where field is required but Empty Value was not checked
/// <summary>
/// Validates the Beginning Balance
/// </summary>
public string ValidateBeginningBalance(decimal? beginningBalance)
{
	string Msg = null;
	if (mmType.IsEmpty(beginningBalance))
	{
		this.EntityPropertyDisplayName = "Beginning Balance";

		Msg = this.RequiredFieldMessagePrefix + 
			this.EntityPropertyDisplayName + 
			this.RequiredFieldMessageSuffix;

		AddErrorProviderBrokenRule("BeginningBalance",  Msg);
	}
	return Msg;
}
Rule where required but Allow Empty Value was checked
/// <summary>
/// Validates the Ending Balance
/// </summary>
public string ValidateEndingBalance(decimal endingBalance)
{
	string Msg = null;
	if (mmType.IsEmpty(endingBalance, true))
	{
		this.EntityPropertyDisplayName = "Ending Balance";

		Msg = this.RequiredFieldMessagePrefix + 
			this.EntityPropertyDisplayName + 
			this.RequiredFieldMessageSuffix;

		AddErrorProviderBrokenRule("EndingBalance",  Msg);
	}
	return Msg;
}
Bottom line is when checking mmType.IsEmtpty you need to pass in the additional parameter of "true"
Timothy
Timothy Bryan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform