modelmetadata Questions
2
In Entity Framework 6 I could get the ModelMetadata for a class (myModel) like this:
var modelMetadata = ModelMetadataProviders.Current.GetMetadataForType(null, myModel.GetType());
How can I do ...
Selda asked 30/3, 2017 at 20:46
2
Solved
What I want to do seems so simple.
In my index.cshtml I want to display the WizardStepAttribute Value
So, a user will see at the top of each page, Step 1: Enter User Information
I have a ViewM...
Lyublin asked 26/7, 2011 at 18:35
5
Solved
I'm curious to find out if it is possible to override the [Required] attribute that has been set on a model. I'm sure there most be a simple solution to this problem, any takers?
Suter asked 18/1, 2012 at 0:55
3
Solved
I use AutoMapper to map my domain objects to my view models. I have metadata in my domain layer, that I would like to carry over to the view layer and into ModelMetadata. (This metadata is not UI l...
Herstein asked 3/4, 2012 at 8:35
5
Solved
I'm writing an MVC2 app using DataAnnotations. I have a following Model:
public class FooModel
{
[ScaffoldColumn("false")]
public long FooId { get; set; }
[UIHint("BarTemplate")]
public Date...
Uphemia asked 24/10, 2010 at 16:27
3
I'm using the Entity Framework 4.1 with Code First approach. I'm able to get the storage model types and column names of my entities:
var items = context.ObjectContext.MetadataWorkspace.GetI...
Similarity asked 24/5, 2011 at 7:2
2
Solved
I have fields that different people should see in different names.
For example, suppose I have the following user types:
public enum UserType {Expert, Normal, Guest}
I implemented an IMetadata...
Lindsylindy asked 5/3, 2013 at 9:48
6
Solved
After upgrading to MVC 3 RTM I get an exception where it previously worked.
Here is the scenario. I have several objects that use the same underlying interfaces IActivity and IOwned.
IActivity i...
Experienced asked 15/1, 2011 at 22:24
1
Solved
I have an ASP.NET MVC 4 site and I am passing a nested property to an EditorTemplate and building the field name using ViewData.ModelMetadata.PropertyName however, this gets the property name of th...
Ascetic asked 27/3, 2013 at 8:43
2
Solved
I created a HtmlHelper for Label that puts a star after the name of that Label if associated field is required:
public static MvcHtmlString LabelForR<TModel, TValue>(
this HtmlHelper<TMo...
Leith asked 12/10, 2011 at 6:43
2
I'm trying to use the WebGrid html helper in ASP.NET MVC 3 to autogenerate the columns according to the information found in the ModelMetadata. For example the code in a view that accepts a list of...
Oast asked 2/2, 2011 at 12:37
2
One of the key features of a project I'm working on is the ability for the user to configure Forms (as in "Forms" to fill-up) based on a pool of pre-existing field types (well known types, for inst...
Lewandowski asked 14/9, 2012 at 14:32
2
Solved
Say I have a model like this
public class User
{
[Required]
[StringLength(14, ErrorMessage = "Can only be 14 characters long")]
public string UserName;
}
I want to create a Html helper like ...
Pathway asked 30/4, 2012 at 10:13
2
Solved
I have a viewmodel that includes a complex property of type TestThing which is declared as:
public class TestThing
{
[Display(Name = "String3", Prompt = "String4")]
public string Test1 { get; se...
Glyptography asked 17/3, 2011 at 9:5
3
According to this blog post "ModelMetadata objects are constructed with data taken from attributes, primarily from the System.ComponentModel and System.ComponentModel.DataAnnotations namespaces."
...
Flack asked 17/8, 2011 at 15:0
1
Solved
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 DatePi...
Chadburn asked 17/10, 2010 at 13:59
1
© 2022 - 2024 — McMap. All rights reserved.