Search Results

Search found 7702 results on 309 pages for 'django validation'.

Page 149/309 | < Previous Page | 145 146 147 148 149 150 151 152 153 154 155 156  | Next Page >

  • CSS Validation Warning: Same colors for color and background-color in two contexts

    - by TankDriver
    I am getting a ton of warnings like the ones listed below when I do a CSS validation check via http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.gamefriction.com%2FCoded&profile=css21&usermedium=all&warning=1&lang=en > 513 Same colors for color and > background-color in two contexts > #blue_module and #red_module_top 513 Same colors for color and > background-color in two contexts > .content ul li and #red_module_top 513 > Same colors for color and > background-color in two contexts > #footer_container and #red_module_top 513 Same colors for color and > background-color in two contexts > ul.tabs li a.active and > #red_module_top 513 Same colors for color and background-color in two > contexts #content_960 and > #red_module_top 513 Same colors for color and background-color in two > contexts #content_main and > #red_module_top 513 Same colors for color and background-color in two > contexts .content and #red_module_top > 513 Same colors for color and > background-color in two contexts > #league_module select option and #red_module_top 513 Same colors for color and background-color in two > contexts #red_module and > #red_module_top Any ideas how to fix this? CSS file: gamefriction.com/Coded/css/style.css

    Read the article

  • Unit Testing - Validation of ViewModel ASP.NET MVC 2

    - by dean nolan
    I am currently unit testing a service that adds users to a repository. I am using dependency injection to test using a fake repository. The repository has a method CreateUser(User user) which just adds it to the database or in this case a List of Users. The logic for the creation is in the UserServices class. The application has a form for creating a user that requires some properties such as name and address. This is an MVC 2 app and I will be using the new validation using data annotations. This makes me wonder about a few things: 1) Should I annotate a POCO object that will map to the database? Or should I create a specific View Model that has these annotations and pass this data to the UserServices class? 2)Should the UserServicesClass also check this data? Would I best be constructing a Usr out of the ViewModel and passing this into the Service as a parameter? 3) The actual unit testing would depend on 2), I either populate a User object and pass that in, or I pass a large list of strings to the method CreateUser. Writing this out I get a basic idea that I should probably annotate the view model only, pass in a user (constructed by the view model if the data is valid) and also just construct the user in the unit test also. Is this the best way to go?

    Read the article

  • Invalid security validation exception inside a SharePoint workflow

    - by Dan Revell
    I'm having a strange security problem with a SharePoint workflow. Particular calls seem to result in the following exception: Microsoft.SharePoint.SPException: The security validation for this page is invalid. I've come across this error before and the simple fix is web.AllowUnsafeUpdates = true; ... web.AllowUnsafeUpdates = false; However I've never once encountered this problem inside a workflow before since a workflow runs as system. I first got this error in a code activity where I set the value of a column on the list item. Wrapping the item.Update in AllowUnsafeUpdates fixed it. After the code activity I have a CreateTask activity. This also causes the same error but only after running the code inside the activity's MethodInvoking. In both cases there's a SPListItem.UpdateItem involved within the stack trace. This call is failing a security check. I don't know anything about how this check works so I don't know where to look next. This is a strange one, because this SharePoint dev machine has been working fine for some time. No other projects or workflows exhibit this behaviour so that rules out an installation problem. There's just something about this particular workflow. [UPDATE] I've gotten around the issue by just creating a new project and building it up again. I still have the broken one and I'd still like to figure out the problem with it. I'd appreciate any suggestions of what it might be.

    Read the article

  • How to add validation errors in the validation collection asp.net mvc?

    - by johndoe
    Inside my controller's action I have the following code: public ActionResult GridAction(string id) { if (String.IsNullOrEmpty(id)) { // add errors to the errors collection and then return the view saying that you cannot select the dropdownlist value with the "Please Select" option } return View(); UPDATE: if (String.IsNullOrEmpty(id)) { // add error ModelState.AddModelError("GridActionDropDownList", "Please select an option"); return RedirectToAction("Orders"); } } UPDATE 2: Here is my updated code: @Html.DropDownListFor(x => x.SelectedGridAction, Model.GridActions,"Please Select") @Html.ValidationMessageFor(x => x.SelectedGridAction) The Model looks like the following: public class MyInvoicesViewModel { private List<SelectListItem> _gridActions; public int CurrentGridAction { get; set; } [Required(ErrorMessage = "Please select an option")] public string SelectedGridAction { get; set; } public List<SelectListItem> GridActions { get { _gridActions = new List<SelectListItem>(); _gridActions.Add(new SelectListItem() { Text = "Export to Excel", Value = "1"}); return _gridActions; } } } And here is my controller action: public ActionResult GridAction(string id) { if (String.IsNullOrEmpty(id)) { // add error ModelState.AddModelError("SelectedGridAction", "Please select an option"); return RedirectToAction("Orders"); } return View(); } Nothing happens! I am totally lost on this one! UPDATE 3: I am now using the following code but still the validation is not firing: public ActionResult GridAction(string id) { var myViewModel= new MyViewModel(); myViewModel.SelectedGridAction = id; // id is passed as null if (!ModelState.IsValid) { return View("Orders"); }

    Read the article

  • XHTML Validation issue trying to render '&' character inside an ASP.Net control

    - by Micah
    Ok, the description is kind of funky, but here's my problem: <asp:ListItem Value="0">All Leads <i>(include Archive & Trash)</i></asp:ListItem> <asp:ListItem Value="0">All Leads <i>(include Archive &amp; Trash)</i></asp:ListItem> <asp:ListItem Value="0" Text="All Leads <i>(include Archive & Trash)</i>" /> <asp:ListItem Value="0" Text="All Leads <i>(include Archive &amp; Trash)</i>" /> All three versions render the following html All Leads <i>(include Archive & Trash)</i> This of course fails XHTML validation. It needs to render the html like this: All Leads <i>(include Archive &amp; Trash)</i> How can I fix this? Thanks.

    Read the article

  • Custom control doesn't fire validation

    - by Ed Woodcock
    I've written a custom ASP.net control that descends from LinkButton and overrides the Render() method. I'm using it to replace ImageButtons in the site I'm working on so we don't have to have an image for each button. This control works fine, does the required post-backs etc., however it doesn't fire the validators in its validation group. This is obviously an issue. The code for the control is (condensed) as follows: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public class CustomButton : LinkButton { public string SpanCssClass { get; set; } protected override void Render(HtmlTextWriter writer) { if (!Visible) { return; } writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID); writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID); writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClass); string postback = string.IsNullOrEmpty(OnClientClick) ? "javascript:__doPostBack('" + UniqueID + "','');" : OnClientClick; writer.AddAttribute(HtmlTextWriterAttribute.Href, postback); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.AddAttribute(HtmlTextWriterAttribute.Class, SpanCssClass); writer.RenderBeginTag(HtmlTextWriterTag.Span); writer.Write(Text); writer.RenderEndTag(); writer.RenderEndTag(); } } Does anyone know why this would not be causing the validators to fire? I was under the impression that leaving all the other methods in LinkButton un-overridden would leave all the other functionality the same!

    Read the article

  • Netbeans PHP Validation sees endif as a syntax error

    - by Asaf
    I have this part of code <?php for ($j=0; $j < $count; $j++): ?> <?php if(isset(votes[$j])): ?> <dt>something something</dt> <dd> <span><?php echo $result; ?>%</span> <div class="bar"> </div> </dd> <?php else: ?> <dt>info</dt> <dd> <span>0</span> <div class="bar"> <div style="width: 0px"></div> </div> </dd> <?php endif; ?> <?php endfor; ?> now Netbeans insists that on the endif line (near the end) there's a syntax error: Error Syntax error: expected: exit, identifier, variable, function... Is there some sort of known problem with the validation of endif on Netbeans ?

    Read the article

  • spyr validation text with jquery serialize()

    - by oz1453
    Code like this : <form> <ol> <li> <fieldset> <legend>test</legend> <ol> <li> <label for="qwerty">qwerty</label> <span id="sprytextfield1"> <input name="qwerty" type="text" id="qwerty" /> <span class="textfieldRequiredMsg">error no qwerty input</span></span> </li> </ol> </fieldset> </li> </ol> <p style="text-align:right;"> <input type="reset" value="reset" /> <input type="submit" value="submit" /> </p> </form> <script type="text/javascript"> $('form').submit(function() { alert($(this).serialize()); return false; }); <!-- var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]}); //--> </script> I want to do. when i click the submit button serialize the form but when no error with spyr. if the spyr validation text error appears don t serialize or alert. i think.i must make a if condition before alert.

    Read the article

  • asp.net jquery how to use Plugin/Validation with web content

    - by Eyla
    I have a asp.net web content from that have a asp.net textbox and I want to use Plugin/Validation but it is not working with me here is my code: <%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="IMAM_APPLICATION.WebForm1" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <script src="js/jquery-1.4.1.js" type="text/javascript"></script> <script src="js/jquery.validate.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $.validator.addMethod("#<%=TextBox1.ClientID %>", function(value, element) { return this.optional(element) || /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,16}$/i.test(value); }, "Passwords are 8-16 characters with uppercase letters, lowercase letters and at least one number."); }); </script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> </asp:Content> <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </asp:Content>

    Read the article

  • asp.net jquery how to use Plugin/Validation wormith web content

    - by Eyla
    I have a asp.net web content from that have a asp.net textbox and I want to use Plugin/Validation but it is not working with me here is my code: <%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="IMAM_APPLICATION.WebForm1" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <script src="js/jquery-1.4.1.js" type="text/javascript"></script> <script src="js/jquery.validate.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $.validator.addMethod("#<%=TextBox1.ClientID %>", function(value, element) { return this.optional(element) || /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,16}$/i.test(value); }, "Passwords are 8-16 characters with uppercase letters, lowercase letters and at least one number."); </script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> </asp:Content> <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </asp:Content>

    Read the article

  • Executing logic before save or validation with EF Code-First Models

    - by Ryan Norbauer
    I'm still getting accustomed to EF Code First, having spent years working with the Ruby ORM, ActiveRecord. ActiveRecord used to have all sorts of callbacks like before_validation and before_save, where it was possible to modify the object before it would be sent off to the data layer. I am wondering if there is an equivalent technique in EF Code First object modeling. I know how to set object members at the time of instantiation, of course, (to set default values and so forth) but sometimes you need to intervene at different moments in the object lifecycle. To use a slightly contrived example, say I have a join table linking Authors and Plays, represented with a corresponding Authoring object: public class Authoring { public int ID { get; set; } [Required] public int Position { get; set; } [Required] public virtual Play Play { get; set; } [Required] public virtual Author Author { get; set; } } where Position represents a zero-indexed ordering of the Authors associated to a given Play. (You might have a single "South Pacific" Play with two authors: a "Rodgers" author with a Position 0 and a "Hammerstein" author with a Position 1.) Let's say I wanted to create a method that, before saving away an Authoring record, it checked to see if there were any existing authors for the Play to which it was associated. If no, it set the Position to 0. If yes, it would find set the Position of the highest value associated with that Play and increment by one. Where would I implement such logic within an EF code first model layer? And, in other cases, what if I wanted to massage data in code before it is checked for validation errors? Basically, I'm looking for an equivalent to the Rails lifecycle hooks mentioned above, or some way to fake it at least. :)

    Read the article

  • Add/remove validation rules Dynamically

    - by eddy
    Hi, I need to dynamically add validation rules to a text box when the user clicks on the checkbox in that row and remove it when the user unchecks it. This is what I did, and it works fine, but I'm not sure if it is the right way to do it. Here's my html code: <tbody> <c:forEach items="${list}" var="item"> <tr> <td align="center"> <input type="checkbox" name="selectItems" value="<c:out value="${item.numberPlate}"/>" /> </td> <td align="left"><c:out value="${item.numberPlate}"/></td> <td align="left"><c:out value="${item.driver.fullName}"/></td> <td align="left"><input type="text" name="mileage_<c:out value="${item.numberPlate}"/>" value="" /></td> </tr> </c:forEach> </tbody> and my jquery: $("input[name=selectItems]").change(function() { if (this.checked) { $(this).closest("tr").find("input[name^=mileage]").attr("class","required"); $(this).closest("tr").find("input[name^=mileage]").attr("number",true); } else { $(this).closest("tr").find("input[name^=mileage]").attr("class","") } }); any suggestion is welcome and... I almost forgot, Merry Xmas!

    Read the article

  • ASP.NET enum dropdownlist validation

    - by Arun Kumar
    I have got a enum public enum TypeDesc { [Description("Please Specify")] PleaseSpecify, Auckland, Wellington, [Description("Palmerston North")] PalmerstonNorth, Christchurch } I am binding this enum to drop down list using the following code on page_Load protected void Page_Load(object sender, EventArgs e) { if (TypeDropDownList.Items.Count == 0) { foreach (TypeDesc newPatient in EnumToDropDown.EnumToList<TypeDesc>()) { TypeDropDownList.Items.Add(EnumToDropDown.GetEnumDescription(newPatient)); } } } public static string GetEnumDescription(Enum value) { FieldInfo fi = value.GetType().GetField(value.ToString()); DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false); if (attributes != null && attributes.Length > 0) return attributes[0].Description; else return value.ToString(); } public static IEnumerable<T> EnumToList<T>() { Type enumType = typeof(T); // Can't use generic type constraints on value types, // so have to do check like this if (enumType.BaseType != typeof(Enum)) throw new ArgumentException("T must be of type System.Enum"); Array enumValArray = Enum.GetValues(enumType); List<T> enumValList = new List<T>(enumValArray.Length); foreach (int val in enumValArray) { enumValList.Add((T)Enum.Parse(enumType, val.ToString())); } return enumValList; } and my aspx page use the following code to validate <asp:DropDownList ID="TypeDropDownList" runat="server" > </asp:DropDownList> <asp:RequiredFieldValidator ID="TypeRequiredValidator" runat="server" ControlToValidate="TypeDropDownList" ErrorMessage="Please Select a City" Text="<img src='Styles/images/Exclamation.gif' />" ValidationGroup="city"></asp:RequiredFieldValidator> But my validation is accepting "Please Specify" as city name. I want to stop user to submit if the city is not selected.

    Read the article

  • jQuery password strength plugin callback validation method

    - by jmorhardt
    I'm using a a jQuery plugin to evaluate password strength. It gives a graphical representation for the user to see how secure the password is. I'd like to use it to validate the field as well. The plugin works by assessing the password and giving it a score. I want to be able to verify that the user has entered a password of at least a certain score. The code is hosted on jQuery's site here: http://plugins.jquery.com/project/pstrength. The documentation states that there is a way to add a rule and do custom validation. I'm not sure where to start. The inline documentation states: * === Changelog === * Version 2.1 (18/05/2008) * Added a jQuery method to add a new rule: jQuery('input[@type=password]').pstrength.addRule(name, method, score, active) And later in the code there's this method: jQuery.extend(jQuery.fn.pstrength, { 'addRule': function (name, method, score, active) { digitalspaghetti.password.addRule(name, method, score, active); return true; }, 'changeScore': function (rule, score) { digitalspaghetti.password.ruleScores[rule] = score; return true; }, 'ruleActive': function (rule, active) { digitalspaghetti.password.rules[rule] = active; return true; } }); If anybody has seen an example of how to do this I'd appreciate a pointer in the right direction. Thanks!

    Read the article

  • HTML Helper/Text Box validation

    - by slandau
    I have this input on the view: <%= Html.TextBoxCurrentDateWithoutPermission("EffectiveDate", Model.EffectiveDate.HasValue ? Model.EffectiveDate.Value.ToString("dd-MMM-yyyy") : "", new string[] { PERMISSIONS.hasICAdvanced }, new { @class = "economicTextBox", propertyName = "EffectiveDate", onchange = "parseAndSetDt(this); ", dataType = "Date" })%> Here is the custom HTML Helper: public static MvcHtmlString TextBoxCurrentDateWithoutPermission( this HtmlHelper htmlHelper, string name, object value, string[] permissions, object htmlAttributes ) { foreach (string permission in permissions) { if (Chatham.Web.UI.Extranet.SessionManager.DisplayUser.IsInRole(permission)) { // the user has the permission => render the textbox return htmlHelper.TextBox(name, value, htmlAttributes); } } // the user has no permission => render a readonly checkbox var mergedHtmlAttributes = new RouteValueDictionary(htmlAttributes); mergedHtmlAttributes["disabled"] = "disabled"; return htmlHelper.TextBox(name, value == "" ? DateTime.Now : value, mergedHtmlAttributes); } The way this works now is, when a user does NOT have the permission passed in, the box is disabled. The way it needs to be -- if the user does NOT have the permission passed in, it needs to be enabled, however the only dates it can accept are todays date AND dates in the future. So I need JQuery validation (or just plain JS), for this textbox on the page for the following case: If the textbox is enabled AND the user does not have the permission, allow the user to input the current date or future dates ONLY.

    Read the article

  • validation before ajax form submission

    - by ZX12R
    How do i introduce validation before remote_form_for submits? I have javascript function called validateForm(). I am able to call it before the AJAX request process. I tried to use return false and event.preventDefault. But there seems to be no effect. Here is what my code looks like <% remote_form_for :customer, :update =>"uxScreenLoaderDiv", :url => {:action => "login", :controller => "site"}, :html => {:id => "uxLoginForm"}, :onsubmit => "validateForm(event)" do |f| %> User name : <%= f.text_field "uxUserName", :class => "TextBox", :style => "width:100px;" %>&nbsp;* &nbsp;Password : <%= f.password_field "uxPassword", :class => "TextBox", :style => "width:100px;" %>&nbsp;* <%= f.submit "Go!", :class => "Button-Simple", :id => "uxSubmitButton" %> <% end %> the javascript function is simple as follows function validateForm(event){ return false; //event.preventDefault(); }

    Read the article

  • Login form validation using javascript and php

    - by ipl
    Hi, I have been trying to create a login form using javascript.My login form needs to do the fllowing using javascript validation 1.login field contains only letters with a minimum of 4 and a maximum of 6 letters 2.password is at least 5 characters long and not more than 7 characters and contains only letters and digits with at least 1 letter and at least 1 digit 3.if the data is incorrect, generate an alert window with an appropriate message and set the cursor to the incorrect input field and the form needs to be submitted to a php file which needs to validate against a text file I tried to use regular expression to check for the login fiels and password in the javascript and i have used a login .php but havent done anything in that till now.However my javascript/html file which i have pasted below doesnt seem to work.Can anyone tell me the issue with my file? Rgds ip function validateFormOnSubmit(theForm) { reason += validateUsername(theForm.username.value) reason += validatePassword (theForm.pwd.value) if (reason == "") return true else { alert(reason); return false } } function validateUsername(fld) { if (fld == "") return "No username entered" else if((fld.length 6) || (fld.length 7 ) { return "length shoild be b/w 4 and 7"; } else if (!/[a-z]/.test(fld) || !/[A-Z]/.test(fld) || !/[0-9]/.test(fld)){ return "passwords rewuire one of the letters or digitys"; } } SignupForm Your user name: Your Password:    

    Read the article

  • jQuery dynamic validation

    - by kpomka
    Hi there Im trying to do a few things with jQuery validation plugin and seems stuck on one place. Here is some code: <script type="text/javascript"> $(document).ready(function(){ $('#myform').validate(); $('#email').rules('add', {required: true, messages: {required: 'email is required'}} ); $('#phone').rules('add', {required: true, messages: {required: 'phone is required'}} ); $('#validate').click(function(){ $('#result').text($('#myform').validate().form()); return false; }); }); </script> <form id="myform"> <div>email:<input type="text" id="email" /></div> <div>phone:<input type="text" id="phone" /></div> <div id="result"></div> <input id="valdate" type="image" src="images/submit.png" /> </form> As a result i keep getting a wrong error message. If i click on submit button 'phone is required' is shown near email input and 'email is required' isnt shown at all. Whats wrong with this code ?

    Read the article

  • How to layer if statements when order of logic is irrelevant?

    - by jimmyjimmy
    Basically I have a series of logic in my website that can lead to 5 total outcomes. Basically two different if tests and then a catch all else statement. For example: if cond1: if mod1: #do things elif mod2: #do things elif cond2: if mod1: #do things elif mod2 #do things else: #do things I was thinking about rewriting it like this: if cond1 and mod1: #do things elif cond1 and mod2: #do things elif cond2 and mod1: #do things elif cond2 and mod2: #do things else: #do things Is there any real difference in these two coding options/a better choice for this kind of logic testing?

    Read the article

  • How do I install OSQA with limited access to the server?

    - by Noir
    I would very much like to install OSQA on my host (provided/owned by my friend), but I can not make heads or tails of how I would go about doing it; a lot of the dependancies and such can't be installed with the current level of access (or most probably just knowledge) that I have. I can provide any further information required, and attempt to contact (friend) to see if he can do any of it for me, but I'm unsure as to how often I will be able to contact him. exec and shell_exec are not disabled on the server. If there are any other alternatives that I could use, please let me know! I tried Qwench but that was pretty buggy. I can usually deal with these kind of things, but this is my first foray into Python stuff!

    Read the article

  • UpdateModel() fails after migration from MVC 1.0 to MVC 2.0

    - by Alastair Pitts
    We are in the process of migrating our ASP.NET MVC 1.0 web app to MVC 2.0 but we have run into a small snag. In our report creation wizard, it is possible leave the Title text box empty and have it be populated with a generic title (in the post action). The code that does the update on the model of the Title is: if (TryUpdateModel(reportToEdit, new[] { "Title" })) { //all ok here try to create (custom validation and attach to graph to follow) //if title is empty get config subject if (reportToEdit.Title.Trim().Length <= 0) reportToEdit.Title = reportConfiguration.Subject; if (!_service.CreateReport(1, reportToEdit, SelectedUser.ID, reportConfigID, reportCategoryID, reportTypeID, deviceUnitID)) return RedirectToAction("Index"); } In MVC 1.0, this works correctly,the reportToEdit has an empty title if the textbox is empty, which is then populated with the Subject property. In MVC 2.0 this fails/returns false. If I add the line above: UpdateModel(reportToEdit, new[] { "Title" }); it throws System.InvalidOperationException was unhandled by user code Message="The model of type 'Footprint.Web.Models.Reports' could not be updated." Source="System.Web.Mvc" StackTrace: at System.Web.Mvc.Controller.UpdateModel[TModel](TModel model, String prefix, String[] includeProperties, String[] excludeProperties, IValueProvider valueProvider) at System.Web.Mvc.Controller.UpdateModel[TModel](TModel model, String[] includeProperties) at Footprint.Web.Controllers.ReportsController.Step1(FormCollection form) in C:\TFS Workspace\ExtBusiness_Footprint\Branches\apitts_uioverhaul\Footprint\Footprint.Web\Controllers\ReportsController.cs:line 398 at lambda_method(ExecutionScope , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) InnerException: Reading the MVC2 Release notes I see this breaking change: Every property for model objects that use IDataErrorInfo to perform validation is validated, regardless of whether a new value was set. In ASP.NET MVC 1.0, only properties that had new values set would be validated. In ASP.NET MVC 2, the Error property of IDataErrorInfo is called only if all the property validators were successful. but I'm confused how this is affecting me. I'm using the entity framework generated classes. Can anyone pinpoint why this is failing?

    Read the article

  • How can I validate the result in an ASP.NET MVC editor template?

    - by Morten Christiansen
    I have created an editor template for representing selecting from a dynamic dropdown list and it works as it should except for validation, which I have been unable to figure out. If the model has the [Required] attribute set, I want that to invalidate if the default option is selected. The view model object that must be represented as the dropdown list is Selector: public class Selector { public int SelectedId { get; set; } public IEnumerable<Pair<int, string>> Choices { get; private set; } public string DefaultValue { get; set; } public Selector() { //For binding the object on Post } public Selector(IEnumerable<Pair<int, string>> choices, string defaultValue) { DefaultValue = defaultValue; Choices = choices; } } The editor template looks like this: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <select class="template-selector" id="<%= ViewData.ModelMetadata.PropertyName %>.SelectedId" name="<%= ViewData.ModelMetadata.PropertyName %>.SelectedId"> <% var model = ViewData.ModelMetadata.Model as QASW.Web.Mvc.Selector; if (model != null) { %> <option><%= model.DefaultValue %></option><% foreach (var choice in model.Choices) { %> <option value="<%= choice.Value1 %>"><%= choice.Value2 %></option><% } } %> </select> I sort of got it to work by calling it from the view like this (where Category is a Selector): <%= Html.ValidationMessageFor(n => n.Category.SelectedId)%> But it shows the validation error for not supplying a proper number and it does not care if I set the Required attribute.

    Read the article

  • Create Class functions on the fly?

    - by JasonS
    Hi, i have a validation class which needs improving. If I require some custom validation I need to specify a custom function. It works a bit like this: The controller tells the validation that a custom validation function is required. The controller runs the validation. --- Gets iffy here --- Validation class creates a new instance of the controller class.... Validation class runs controller-custom_validation_function() Validation class returns true / false Is there someway that I can alter this to do something like this? $validation = new validation; // Insert rules here. $validation-function() = $this-function(); By doing this I could get rid of the step of creating an unneeded class instance.

    Read the article

  • WPF DataValidation on a DataTemplate object in an ItemsControl

    - by Matt H.
    I have two datatemplates, both very similar... here is one of them: <DataTemplate x:Key="HeadingTemplate"> <Grid x:Name="mainHeadingGrid" Margin="5,5,30,0" HorizontalAlignment="Stretch"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition /> </Grid.ColumnDefinitions> <TextBlock Grid.Column="1" Margin="30,3,10,0" Foreground="Black" FontWeight="Bold" HorizontalAlignment="Left" TextWrapping="Wrap"> <TextBlock.Text> <MultiBinding Converter="{StaticResource myHeadingConverter}" ConverterParameter="getRNHeadingTitle" Mode="TwoWay"> <Binding Path="num"/> <Binding Path="name"/> </MultiBinding> </TextBlock.Text> </TextBlock> <TextBox Grid.Column="1" Text="{Binding Path=moreInfo}"/> </Grid> </DataTemplate> I use an selector in my ItemsControl to choose between the two, based on the object it is bound to. I want to use validation to check through all of the properties and put a big exclamation point in front of the whole datatemplate as it is displayed in the itemscontrol. how do I do this? All of the examples I've found explain how to set a ValidationRule on a specific control in the datatemplate, in that control's binding. I want to apply my validation rule to the entire template... Help! :)

    Read the article

  • Padding is invalid and cannot be removed

    - by Ajay
    I have hosted an asp.net 2.0 site. Everyday, i am getting an error "Padding is invalid and cannot be removed" 2-3 times. Backend used is sql server 2005. the site is controlled via plesk 9.2 CP. Pooling is enabled with timeout as 120 Minutes, in IIS. Can it be the reason for this? I have not used any encryption except for the stored passwords(MD5) The error message is : " Base Exception = : Padding is invalid and cannot be removed. - Source : System.Web - TargetSite :Void ThrowError(System.Exception, System.String, System.String, Boolean)Message : Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. " & System Log (Application) says " Event code: 4009 Event message: Viewstate verification failed. Reason: The viewstate supplied failed integrity check. Event detail code: 50203 ViewStateException information: Exception message: Invalid viewstate. Port: 31235 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) " I have hosted it in a dedicated server and not in a web farm. Will keeping a static machine key help resolve this issue? Please guide me on this.

    Read the article

< Previous Page | 145 146 147 148 149 150 151 152 153 154 155 156  | Next Page >