This is pretty much a duplicate question but instead of using Castle Dynamic Proxy I'm using LinFu http://stackoverflow.com/questions/1415675/getting-underlying-type-of-a-proxy-object
I'm using automapper to create proxies of interfaces that I'm sending to my viewmodel in Asp.net MVC. My problem is from what I can tell that MVC's defau...
Inherited properties and MetadataType does not seem to work with client side validation in ASP.NET MVC 2.
The validation of our MetadataTypes work as expected on the server but for some reason it does not generate the appropriate client scripts for it. Client side validation kicks in as expected for properties with the DataAnnotations a...
If I have a table Orders with fields CustomerID, OrderID and OrderDate, then the "Linq-to-SQL classes" generated class will be called Orders, with members called CustomerID, OrderID and OrderDate. So far so good.
However, if I then do Html.LabelFor(m => m.OrderDate) then the generated text will be "OrderDate" instead of "Order Date".
I...
I've just finished reading http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-2-modelmetadata.html In the article Brad lists the Watermark property but there is no mention of which DataAnnotation is used to populate it.
...
I want to include certain .js and .css files only on pages that need them.
For example, my EditorTemplate DateTime.ascx needs files anytimec.js and anytimec.css.
That template is applied whenever I use either the EditorFor or EditorForModel helper methods in a view for a model with a DateTime type value.
My technique:
I've put this c...
I'm building a custom MetadataProvider and I'd like to access the actuall model value in the CreateMetadata method.
public class IcpMetadataProvider : AssociatedMetadataProvider
{
protected override ModelMetadata CreateMetadata(IEnumerable<Attribute> attributes, Type containerType, Func<object> modelAccessor, Type modelType, strin...
Iv wrote an MetaDataProvider like the one below and am using it in conjunction with Editor templates. The DisplayName is working correctly, but for some reason the ShowForEdit value it not having any effect. Any ideas?
public class MyModelMetadataProvider : DataAnnotationsModelMetadataProvider
{
protected override ModelMetadata ...
I have written a custom DataAnnotationsModelMetadataProvider that sets HideSurroundingHtml dynamically.
public class ContentDrivenModelMetadataProvider : DataAnnotationsModelMetadataProvider
{
protected override ModelMetadata CreateMetadata(IEnumerable<Attribute> attributes, Type containerType,
...
I'm trying to call DisplayFor and DisplayForModel to iterate an IEnumerable<> with various element types from within a view. I have Templates defined for each element/Model type.
What I would like to do is check the ViewData.ModelMetadata.ContainerType from within the Template so that Template can determine if it was called as part of a...
I build a bunch of data mining models on training data that is located in different folders. For eg. for data in folder1 I build an SVM based model, for data in folder2 I build an naive bayes model. I have almost 100 such folders and each of the folders have different data ( read different attributes ). Is there a framework which enables...
Here's a sample of how it works now:
[MetadataType(typeof(PersonMetadata))]
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
}
public class PersonMetadata
{
[Required]
public string Name { get; set; }
[Range(0,150]
public int Age { get; set; }
}
However I don't want the Metad...
I have a very simple view-model in a dll that I want to keep separated from the main web mvc project.
I am decorating the model with metadata attributes that will help the ui display the correct presentation (DisplayName, UIHint, DataType, ReadOnly etc) and I would like to reuse this information with different presentation layers later ...
I'm learning the ASP MVC2 framework, with no prior knowledge of MVC1. At the moment I'm constructing a toy website for learning purposes.
So far I've been primarily using Html.RenderPartial as my main means of organizing view rendering. In theory I'd prefer something less imperative and more declarative.
I've read several tutorials on ...
Hi folks!
There is a common issue to write strongly-typed Html helpers.
The problem is how to retrieve property name/value pair.
Assume we have following Html helper declaration:
public static string DatePickerFor<TModel>(this HtmlHelper<TModel> helper, Expression<Func<TModel, DateTime?>> expression)
There are several solutions I fou...