Skip to main content

ViewUtils

Shared Utils shared between different Template Filters and Razor Views/Helpers

Assembly: ServiceStack.Common.dll
View Source
Declaration
public static class ViewUtils

Properties

NavItemsKey

View Source
Declaration
public static string NavItemsKey { get; set; }

NavItemsMapKey

View Source
Declaration
public static string NavItemsMapKey { get; set; }

NavItems

View Source
Declaration
public static List<NavItem> NavItems { get; }

NavItemsMap

View Source
Declaration
public static Dictionary<string, List<NavItem>> NavItemsMap { get; }

Fields

ValidationSummaryCssClassNames

View Source
Declaration
public static string ValidationSummaryCssClassNames

ValidationSuccessCssClassNames

View Source
Declaration
public static string ValidationSuccessCssClassNames

Methods

Load(IAppSettings)

View Source
Declaration
public static void Load(IAppSettings settings)
Parameters
TypeName
ServiceStack.Configuration.IAppSettingssettings

ShowNav(NavItem, HashSet<String>)

View Source
Declaration
public static bool ShowNav(this NavItem navItem, HashSet<string> attributes)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.NavItemnavItem
System.Collections.Generic.HashSet<System.String>attributes

GetNavItems(String)

View Source
Declaration
public static List<NavItem> GetNavItems(string key)
Returns

System.Collections.Generic.List<ServiceStack.NavItem>

Parameters
TypeName
System.Stringkey

CssIncludes(IVirtualPathProvider, List<String>)

View Source
Declaration
public static string CssIncludes(IVirtualPathProvider vfs, List<string> cssFiles)
Returns

System.String

Parameters
TypeName
ServiceStack.IO.IVirtualPathProvidervfs
System.Collections.Generic.List<System.String>cssFiles

JsIncludes(IVirtualPathProvider, List<String>)

View Source
Declaration
public static string JsIncludes(IVirtualPathProvider vfs, List<string> jsFiles)
Returns

System.String

Parameters
TypeName
ServiceStack.IO.IVirtualPathProvidervfs
System.Collections.Generic.List<System.String>jsFiles

Nav(List<NavItem>, NavOptions)

Display a list of NavItem's

View Source
Declaration
public static string Nav(List<NavItem> navItems, NavOptions options)
Returns

System.String

Parameters
TypeName
System.Collections.Generic.List<ServiceStack.NavItem>navItems
ServiceStack.NavOptionsoptions

NavLink(NavItem, NavOptions)

Display a nav-link nav-item

View Source
Declaration
public static string NavLink(NavItem navItem, NavOptions options)
Returns

System.String

Parameters
TypeName
ServiceStack.NavItemnavItem
ServiceStack.NavOptionsoptions

NavLink(StringBuilder, NavItem, NavOptions)

Display a nav-link nav-item

View Source
Declaration
public static void NavLink(StringBuilder sb, NavItem navItem, NavOptions options)
Parameters
TypeName
System.Text.StringBuildersb
ServiceStack.NavItemnavItem
ServiceStack.NavOptionsoptions

NavButtonGroup(List<NavItem>, NavOptions)

View Source
Declaration
public static string NavButtonGroup(List<NavItem> navItems, NavOptions options)
Returns

System.String

Parameters
TypeName
System.Collections.Generic.List<ServiceStack.NavItem>navItems
ServiceStack.NavOptionsoptions

NavButtonGroup(NavItem, NavOptions)

View Source
Declaration
public static string NavButtonGroup(NavItem navItem, NavOptions options)
Returns

System.String

Parameters
TypeName
ServiceStack.NavItemnavItem
ServiceStack.NavOptionsoptions

NavLinkButton(StringBuilder, NavItem, NavOptions)

View Source
Declaration
public static void NavLinkButton(StringBuilder sb, NavItem navItem, NavOptions options)
Parameters
TypeName
System.Text.StringBuildersb
ServiceStack.NavItemnavItem
ServiceStack.NavOptionsoptions

IsNull(Object)

View Source
Declaration
public static bool IsNull(object test)
Returns

System.Boolean

Parameters
TypeName
System.Objecttest

GetDefaultCulture(DefaultScripts)

View Source
Declaration
public static CultureInfo GetDefaultCulture(this DefaultScripts defaultScripts)
Returns

System.Globalization.CultureInfo

Parameters
TypeName
ServiceStack.Script.DefaultScriptsdefaultScripts

GetDefaultTableClassName(DefaultScripts)

View Source
Declaration
public static string GetDefaultTableClassName(this DefaultScripts defaultScripts)
Returns

System.String

Parameters
TypeName
ServiceStack.Script.DefaultScriptsdefaultScripts

TextDump(Object)

View Source
Declaration
public static string TextDump(this object target)
Returns

System.String

Parameters
TypeName
System.Objecttarget

TextDump(Object, TextDumpOptions)

View Source
Declaration
public static string TextDump(this object target, TextDumpOptions options)
Returns

System.String

Parameters
TypeName
System.Objecttarget
ServiceStack.TextDumpOptionsoptions

DumpTable(Object)

View Source
Declaration
public static string DumpTable(this object target)
Returns

System.String

Parameters
TypeName
System.Objecttarget

PrintDumpTable(Object)

View Source
Declaration
public static void PrintDumpTable(this object target)
Parameters
TypeName
System.Objecttarget

DumpTable(Object, TextDumpOptions)

View Source
Declaration
public static string DumpTable(this object target, TextDumpOptions options)
Returns

System.String

Parameters
TypeName
System.Objecttarget
ServiceStack.TextDumpOptionsoptions

PrintDumpTable(Object, TextDumpOptions)

View Source
Declaration
public static void PrintDumpTable(this object target, TextDumpOptions options)
Parameters
TypeName
System.Objecttarget
ServiceStack.TextDumpOptionsoptions

HtmlDump(Object)

View Source
Declaration
public static string HtmlDump(object target)
Returns

System.String

Parameters
TypeName
System.Objecttarget

HtmlDump(Object, HtmlDumpOptions)

View Source
Declaration
public static string HtmlDump(object target, HtmlDumpOptions options)
Returns

System.String

Parameters
TypeName
System.Objecttarget
ServiceStack.HtmlDumpOptionsoptions

StyleText(String, TextStyle)

View Source
Declaration
public static string StyleText(string text, TextStyle textStyle)
Returns

System.String

Parameters
TypeName
System.Stringtext
ServiceStack.TextStyletextStyle

HtmlHiddenInputs(IEnumerable<KeyValuePair<String, Object>>)

Emit HTML hidden input field for each specified Key/Value pair entry

View Source
Declaration
public static string HtmlHiddenInputs(IEnumerable<KeyValuePair<string, object>> inputValues)
Returns

System.String

Parameters
TypeName
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.Object>>inputValues

GetErrorStatus(IRequest)

View Source
Declaration
public static ResponseStatus GetErrorStatus(IRequest req)
Returns

ServiceStack.ResponseStatus

Parameters
TypeName
ServiceStack.Web.IRequestreq

HasErrorStatus(IRequest)

View Source
Declaration
public static bool HasErrorStatus(IRequest req)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequestreq

FormQuery(IRequest, String)

View Source
Declaration
public static string FormQuery(IRequest req, string name)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Stringname

FormQueryValues(IRequest, String)

View Source
Declaration
public static string[] FormQueryValues(IRequest req, string name)
Returns

System.String[]

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Stringname

FormValue(IRequest, String)

View Source
Declaration
public static string FormValue(IRequest req, string name)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Stringname

FormValue(IRequest, String, String)

View Source
Declaration
public static string FormValue(IRequest req, string name, string defaultValue)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Stringname
System.StringdefaultValue

FormValues(IRequest, String)

View Source
Declaration
public static string[] FormValues(IRequest req, string name)
Returns

System.String[]

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Stringname

FormCheckValue(IRequest, String)

View Source
Declaration
public static bool FormCheckValue(IRequest req, string name)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Stringname

GetParam(IRequest, String)

View Source
Declaration
public static string GetParam(IRequest req, string name)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Stringname

ToVarNames(String)

Comma delimited field names

View Source
Declaration
public static List<string> ToVarNames(string fieldNames)
Returns

System.Collections.Generic.List<System.String>

Parameters
TypeName
System.StringfieldNames

ToStrings(String, Object)

View Source
Declaration
public static IEnumerable<string> ToStrings(string filterName, object arg)
Returns

System.Collections.Generic.IEnumerable<System.String>

Parameters
TypeName
System.StringfilterName
System.Objectarg

ValidationSummary(ResponseStatus, String)

Show validation summary error message unless there's an error in exceptFor list of fields as validation errors will be displayed along side the field instead

View Source
Declaration
public static string ValidationSummary(ResponseStatus errorStatus, string exceptFor)
Returns

System.String

Parameters
TypeName
ServiceStack.ResponseStatuserrorStatus
System.StringexceptFor

ValidationSummary(ResponseStatus, ICollection<String>, Dictionary<String, Object>)

View Source
Declaration
public static string ValidationSummary(ResponseStatus errorStatus, ICollection<string> exceptFields, Dictionary<string, object> divAttrs)
Returns

System.String

Parameters
TypeName
ServiceStack.ResponseStatuserrorStatus
System.Collections.Generic.ICollection<System.String>exceptFields
System.Collections.Generic.Dictionary<System.String,System.Object>divAttrs

ValidationSuccess(String, Dictionary<String, Object>)

Display a "Success Alert Box"

View Source
Declaration
public static string ValidationSuccess(string message, Dictionary<string, object> divAttrs)
Returns

System.String

Parameters
TypeName
System.Stringmessage
System.Collections.Generic.Dictionary<System.String,System.Object>divAttrs

ErrorResponseExcept(ResponseStatus, String)

Return an error message unless there's an error in fieldNames

View Source
Declaration
public static string ErrorResponseExcept(ResponseStatus errorStatus, string fieldNames)
Returns

System.String

Parameters
TypeName
ServiceStack.ResponseStatuserrorStatus
System.StringfieldNames

ErrorResponseExcept(ResponseStatus, ICollection<String>)

View Source
Declaration
public static string ErrorResponseExcept(ResponseStatus errorStatus, ICollection<string> fieldNames)
Returns

System.String

Parameters
TypeName
ServiceStack.ResponseStatuserrorStatus
System.Collections.Generic.ICollection<System.String>fieldNames

ErrorResponseSummary(ResponseStatus)

Return an error message unless there are field errors

View Source
Declaration
public static string ErrorResponseSummary(ResponseStatus errorStatus)
Returns

System.String

Parameters
TypeName
ServiceStack.ResponseStatuserrorStatus

ErrorResponse(ResponseStatus, String)

Return an error for the specified field (if any)

View Source
Declaration
public static string ErrorResponse(ResponseStatus errorStatus, string fieldName)
Returns

System.String

Parameters
TypeName
ServiceStack.ResponseStatuserrorStatus
System.StringfieldName

ToKeyValues(Object)

View Source
Declaration
public static List<KeyValuePair<string, string>> ToKeyValues(object values)
Returns

System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String,System.String>>

Parameters
TypeName
System.Objectvalues

SplitStringList(IEnumerable)

View Source
Declaration
public static List<string> SplitStringList(IEnumerable strings)
Returns

System.Collections.Generic.List<System.String>

Parameters
TypeName
System.Collections.IEnumerablestrings

ToStringList(IEnumerable)

View Source
Declaration
public static List<string> ToStringList(IEnumerable strings)
Returns

System.Collections.Generic.List<System.String>

Parameters
TypeName
System.Collections.IEnumerablestrings

FormControl(IRequest, Dictionary<String, Object>, String, InputOptions)

View Source
Declaration
public static string FormControl(IRequest req, Dictionary<string, object> args, string tagName, InputOptions inputOptions)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Collections.Generic.Dictionary<System.String,System.Object>args
System.StringtagName
ServiceStack.InputOptionsinputOptions

GetBundleFiles(String, IVirtualPathProvider, IVirtualPathProvider, IEnumerable<String>, String)

View Source
Declaration
public static IEnumerable<IVirtualFile> GetBundleFiles(string filterName, IVirtualPathProvider webVfs, IVirtualPathProvider contentVfs, IEnumerable<string> virtualPaths, string assetExt)
Returns

System.Collections.Generic.IEnumerable<ServiceStack.IO.IVirtualFile>

Parameters
TypeName
System.StringfilterName
ServiceStack.IO.IVirtualPathProviderwebVfs
ServiceStack.IO.IVirtualPathProvidercontentVfs
System.Collections.Generic.IEnumerable<System.String>virtualPaths
System.StringassetExt

BundleJs(String, IVirtualPathProvider, IVirtualPathProvider, ICompressor, BundleOptions)

View Source
Declaration
public static string BundleJs(string filterName, IVirtualPathProvider webVfs, IVirtualPathProvider contentVfs, ICompressor jsCompressor, BundleOptions options)
Returns

System.String

Parameters
TypeName
System.StringfilterName
ServiceStack.IO.IVirtualPathProviderwebVfs
ServiceStack.IO.IVirtualPathProvidercontentVfs
ServiceStack.ICompressorjsCompressor
ServiceStack.BundleOptionsoptions

BundleCss(String, IVirtualPathProvider, IVirtualPathProvider, ICompressor, BundleOptions)

View Source
Declaration
public static string BundleCss(string filterName, IVirtualPathProvider webVfs, IVirtualPathProvider contentVfs, ICompressor cssCompressor, BundleOptions options)
Returns

System.String

Parameters
TypeName
System.StringfilterName
ServiceStack.IO.IVirtualPathProviderwebVfs
ServiceStack.IO.IVirtualPathProvidercontentVfs
ServiceStack.ICompressorcssCompressor
ServiceStack.BundleOptionsoptions

BundleHtml(String, IVirtualPathProvider, IVirtualPathProvider, ICompressor, BundleOptions)

View Source
Declaration
public static string BundleHtml(string filterName, IVirtualPathProvider webVfs, IVirtualPathProvider contentVfs, ICompressor htmlCompressor, BundleOptions options)
Returns

System.String

Parameters
TypeName
System.StringfilterName
ServiceStack.IO.IVirtualPathProviderwebVfs
ServiceStack.IO.IVirtualPathProvidercontentVfs
ServiceStack.ICompressorhtmlCompressor
ServiceStack.BundleOptionsoptions