Search

You searched for the word(s): userid:679872

Matching Posts

  • Optional controller action parameters

    Howdy, I have lots of action methods that have a Paging object parameter. e.g. ActionResult Search(string query, Paging paging); and have registered a paging model binder. If the pageSize and pageIndex don't exist, paging goes to the default. I'd like T4MVC to somehow skip this particular parameter if possible in the helper method generation, so I could simply generate a URL using Url.Action(MVC.Home.Search("donuts")). Currently, it's either all or no parameters. How can I mark
    Posted to T4MVC (Forum) by CVertex on 12/11/2009
  • Providing extra parameters

    I know this is kinda against the point of having the strongly typed helpers, but I found these handy for passing in extra parameters only in very rare circumstances. My example was a jquery popup plugin that read the href for display parameters. public static string Action(this UrlHelper url, ActionResult actionResult, object values) { IT4MVCActionResult ar = actionResult as IT4MVCActionResult; if (ar == null) { throw new NotImplementedException("actionResult is not IT4MVCActionResult"
    Posted to T4MVC (Forum) by CVertex on 12/11/2009
  • MicrosoftMVcjQueryvalidation.js uses variable $

    an experimental project me and my colleagues work on uses uses 3 javascript library (don't ask why), and when I upgraded to preview 2, there was a $ naming conflict The quick solution was to just change all $ references to "jQuery", but we could've wrapped the whole file in a closure to continue using $ usage in this file. no biggie, but just fyi for future versions
    Posted to ASP.NET MVC (Forum) by CVertex on 10/3/2009
  • Re: Injecting into ModelBinders

    Because if I use ModelBinderAttribute to specify my model binder type, the constructed model binder type will not have it's dependencies injected. Make sense? This is because ModelBinderAttribute is using PropertyDescriptors to fetch attribute instances off arguments and actions. I think I'm going to have to roll my own for this situation. But this seems to go against what MS have promised with IoC friendliness.
    Posted to ASP.NET MVC (Forum) by CVertex on 9/21/2009
  • Re: Injecting into ModelBinders

    I'll illustrate with an example Let's say I have a system wide binder DateAndTimeBinder:IModelBinder that binds DateTimes for me. On app start up, this will be inserted into ModelBinders dictionary. Let's say I also have two other binders, OnlyInDistantPastBinder and AfterOtherRecordsBinder that bind differently from DateAndTimeBinder - but all three bind toward DateTime struct. AfterOtherRecordsBinder require DB access to bind and validate properly - e.g. AfterOtherRecords must check
    Posted to ASP.NET MVC (Forum) by CVertex on 9/21/2009
  • Re: Injecting into ModelBinders

    [quote user="Augi"] I just found the best solution :) Derive custom class from ModelBinderDictionary class, override GetBinders method and add following code into your base controller Initialize method (overrided): Binders = new YourDerivedModelBinderDictionary(); [/quote] Very neat! But I would like to use ModelBinderAttribute instead of ModelBinderDictionary to specify my binder. This is true for say DateTime, which will need to be different binders for different actions. I think this
    Posted to ASP.NET MVC (Forum) by CVertex on 9/15/2009
  • Re: Injecting into ModelBinders

    Anyone else have any comment on this problem/issue?
    Posted to ASP.NET MVC (Forum) by CVertex on 9/14/2009
  • Re: Injecting into ModelBinders

    [quote user="Augi"] You could override OnPropertyValidating , OnPropertyValidated , OnModelUpdating or OnModelUpdated method and do the stuff here. [/quote] These hooks for model updating are useful, but don't address my core problem. ModelBinders (if they are to do validation) in my system have some dependencies, which cannot be constructor injection because ModelBinderAttribute relies on Activator.CreateInstance to instantiate the model binding type. There's no way to constructor
    Posted to ASP.NET MVC (Forum) by CVertex on 9/12/2009
  • Injecting into ModelBinders

    Hi, I'm finding it difficult to inject using IoC into ModelBinders that are created via ModelBinderAttribute. The static list of ModelBinders.Binders is easy to inject into because u can set that up in OnAppStart. The reason this is important is that since MS is doing validation in DefaultModelBinder, then custom validation logic (imho) should be done in custom model binder too. How can I accomplish this so I can inject my validator objects into every single way the ModelBinder can get created
    Posted to ASP.NET MVC (Forum) by CVertex on 9/10/2009
  • Model property with data annotations doesn't get validated if it didn't come in the request

    I had a subtle bug where I was relying on the DefaultModelBinder to validate and catch my editModel before it arrived in my action My property had the [Required] and [RegularExpression] attributes, but these were being ignored and invalid values where propagating through my business tier. Turns out I was naming my input field incorrectly in the page, so the the Body property was therefore not found in the request, not binded and not validated. This is probably by design. I guess technically the model
    Posted to ASP.NET MVC (Forum) by CVertex on 8/26/2009
Page 1 of 12 (118 items) 1 2 3 4 5 Next > ... Last »