Geeks With Blogs
My Blog

A while back I wrote about using a semantic model for HTML generation. Today I finally got around to posting our (Phoenix Web Group) extensions for Fubu's HtmlTags library online. The code can be found here.

We added a bunch of missing tags and some extention methods to help make working with nesting and tables easier. (We prefer using params parameters instead an array parameters.) We also added a single static entry point into all of the tags: the Tags class.

Here is some code using our extensions that renders a typical edit field with a label:

public static HtmlTag EditFieldFor(Type modelType, object model, PropertyInfo fieldProperty)
	return Tags.Div
				.LabelFor(modelType, model, fieldProperty)
						.InputFor(modelType, model, fieldProperty)

The real power of using HtmlTags becomes apparent when you use them with HTML input conventions which will be the topic of my next post.

Posted on Thursday, July 15, 2010 6:51 PM | Back to top

Comments on this post: Our extensions for HtmlTags

# re: Our extensions for HtmlTags
Requesting Gravatar...
Thanks for posting these. They look promising. I've used MvcContrib's Fluent HTML API before, which is similar. Also, I was paging through your source I found this:
Left by smartcaveman on Jun 30, 2011 10:07 AM

Your comment:
 (will show your gravatar)

Copyright © Ryan Ohs | Powered by: