customvalidator

customvalidator for dropdownlist not being invoked (apparently)

和自甴很熟 提交于 2019-12-21 23:17:36
问题 Writing a custom validator for a dropdownlist that is using autopostback. Seems to ignore the validation altogether. Why is it ignored and is there an easy fix? Note I did not use ControlToValidate asp.net: <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional" Visible="true" RenderMode="Inline"> <ContentTemplate> <asp:DropDownList ID="ddlCommandAssign" runat="server" AutoPostBack="true"> </asp:DropDownList> <asp:CustomValidator id="val_command_assigned" runat="server"

.NET Web API: Class level validation attribute causes Web API to throw ArgumentNullException if instance is null

。_饼干妹妹 提交于 2019-12-21 13:41:10
问题 I have a DTO class that looks, for example, like this: public class ExampleDto { [DataMember(Name = "Date", IsRequired = true, Order = 1), Required] public DateTime Date { get; set; } [DataMember(Name = "ParentExample", IsRequired = false, Order = 2, EmitDefaultValue = false)] public Guid? ParentExampleId { get; set; } } If, as an example, a user provides an incorrect date, such as this: <?xml version="1.0" encoding="UTF-8" ?> <ExampleDto xmlns="http://customurl/"> <Date>2012-05-25T18:23

ASP.NET Custom Validator + WebMethod + jQuery

落花浮王杯 提交于 2019-12-17 19:44:47
问题 I'm trying to implement a .NET Custom Validator that uses $.ajax to query a WebMethod on the same page and return a boolean value to indicate whether the result is true or false. The WebMethod I'm using is really simple [WebMethod()] public static bool IsPromoValid(string code) { string promoCode = "ABCDEFG"; bool result = code.ToLower() == promoCode.ToLower(); return result; } The CustomValidator looks like this <asp:CustomValidator ID="cvPromoCode" Display="None" ControlToValidate=

My Own javascript validation + MicrosoftMvcValidation . Is it possible ? How

戏子无情 提交于 2019-12-13 05:40:55
问题 I would like to be able to use the MVC validation + my custom javascript validation. The MVC validation is really nice for Model Validation. The main problem here, is that I have more complexe validation. Ex: Case with MVC Validation <div class="editorSmall"> <div class="editor-label bold"> <%: Html.LabelFor(model => model.Location.CurID)%>: </div> <div class="editor-field"> <%:Html.DropDownListFor(model => model.Location.CurID, Model.CurrenciesList)%> <%: Html.ValidationMessageFor(model =>

Static Class Property getting NULL when Custom Validation fired in Silverlight 4 - MVVM

Deadly 提交于 2019-12-13 03:58:44
问题 1. I have created Test Class which contain Static Class and Property. namespace QSys.Data.Domain.DataSecurity { public static class TestData { public static string MyName { get; set; } } } 2. Customer Model class and Custom Validation namespace QSys.Data.Domain { [Serializable()] public class Customer { [Key] public virtual int Id { get; set; } [CustomValidation(typeof(CustomerRequiredRules), "IsCompanyNameEmpty")] public virtual string CompanyName { get; set; } public virtual string City {

What determines the order validators fire in?

亡梦爱人 提交于 2019-12-12 15:09:42
问题 I have a webform with two custom validators: One to validate that a string is a date. I don’t care what format, so long as it’s parseable. Another to ensure that one date is equal to or greater than another. I just couldn’t get the compare validator to play nice with any date format. <asp:TextBox ID="txtResourceStartDate" runat="server" CssClass="textBox mandatory dateField" /> <asp:CustomValidator ID="valResourceStartDateIsDate" runat="server" ControlToValidate="txtResourceStartDate" Display

Custom Validator firing but it does not update the ValidationSummary

旧巷老猫 提交于 2019-12-12 14:09:22
问题 Hi I am working on a custom form field validator, it seems like the custom validator is working by not allowing it to continue to the next page, but it doesn't update the Validation Summary nor does it display the asterisk and the labels that i've made visable. I also have other validators like RequiredFieldValidator on the same field. My ValidationGroup is set, as is the Text and IsValid. I even wrote and set a dummy client side validation method in javascript as some workarounds suggests.

User Control with Client + Server Side CustomValidation; Wrong Client side validator is picked

余生长醉 提交于 2019-12-11 14:24:17
问题 I have a user control which contains a CustomValidator which is used according to whether a RadioButton is checked or not (there are several RadioButtons, I'm only showing the relevant one) <asp:RadioButton runat="Server" ID="RadioBetween" GroupName="DateGroup" CssClass="date_group_options_control_radio" /> <asp:TextBox ID="FromDate" runat="server" Columns="8"></asp:TextBox> <asp:TextBox ID="ToDate" runat="server" Columns="8"></asp:TextBox> <asp:CustomValidator ID="DateValidator" runat=

How to create an custom remote validation attribute with dynamic additiional fields in ASP.NET MVC

本小妞迷上赌 提交于 2019-12-11 13:46:39
问题 I am developing an ASP.NET MVC5 project. In my project I am creating remote validation. For that I just created an custom validation attribute to support server-side validation. My remote validator working fine when remote action has to catch only one field. But I am having problems when I try to bind additional field for it. I mean when I validate with extra fields. Here is my custom remote validation attribute public class RemoteClientServerAttribute : RemoteAttribute { protected override

How to resolve an unexpected quantifier in Javascript regex pattern?

爷,独闯天下 提交于 2019-12-11 13:02:21
问题 Scenario: I've added a client side url validator using the following regex pattern. The pattern is supposed to check whether the URL input matches. ^(?#Protocol)(?:(?:ht|f)tp(?:s?)\:\/\/|~\/|\/)?(?#Username:Password)(?:\w+:\w+@)?(?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:\/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|\/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=