How can I connect to the ASP.NET dynamic data "engine" for the UI?

I decorated my model using the metadata classes attached to my model classes via the MetadataType attribute. I am using Range attribute, required attribute, etc. And some custom attributes I created.

Now I want to hook into the rendering engine (or whatever it is called) of the Dynamic Data structure and be able to change the way the UI is displayed based on my custom attributes as well as the standard System.ComponentModel.DataAnnotations attributes.

Also, I can use ASP.NET MVC, so keep that in mind.

How should I do it? Pointing to links would be great if you don't want to be detailed on how to explain nitty-gritty.

Thank!

-1


source to share


1 answer


There is a dynamic data project for ASP.NET MVC, but I think it is pretty much suspended:

http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=15459

I looked at it a while ago and it partially worked, but I don't think it works with the last bits. I think they are going to put it all together eventually, but it will be for a while. What I am doing right now is that I have some helper classes that read metadata, for example to display required fields, but I am not using full blown dynamic data rendering. You can pull the metadata like this:



public static MetaColumn GetColumn(Type t, string columnName)
{
  MetaModel model = new MetaModel();
  MetaTable table = model.GetTable(t);
  MetaColumn column = table.GetColumn(columnName);
  return column;
}

public static string GetDisplayName(Type t, string columnName)
{
  MetaColumn column = GetColumn(t, columnName);
  return column.DisplayName;
}

      

For now, I'm just using some metadata. I would like to know if you can think of anything else.

+1


source







All Articles