Go to the documentation of this file.00001 using System;
00002 using System.Collections.Generic;
00003 using System.Linq;
00004 using System.Text;
00005 using System.Web.Mvc;
00006
00007 namespace N2.Web.Mvc.Html
00008 {
00009 public static class ContentHtmlExtensions
00010 {
00011 public static bool HasValue(this HtmlHelper html, string detailName)
00012 {
00013 var item = html.CurrentItem();
00014 return item != null && item[detailName] != null;
00015 }
00016
00017 public static bool ValueEquals<TData>(this HtmlHelper html, string detailName, TData expectedValue)
00018 {
00019 var item = html.CurrentItem();
00020 if (item == null)
00021 return false;
00022
00023 object value = item[detailName];
00024 if (value == null && expectedValue == null)
00025 return true;
00026 if (value == null || expectedValue == null)
00027 return false;
00028 if (!(value is TData))
00029 return false;
00030 return expectedValue.Equals((TData)value);
00031 }
00032 }
00033 }