Tacepao extension methods

In your views you can use Html extension methods to render <img />, <input type="image" /> html elements. Actually the methods give you back HtmlString containing the html element. These elements src attributes target MVC actinons. Those actions use the url parameters and configuration settings to render images and write the generated images back to the response stream. There is an Url extension method to get back only the url instead of the full html tag.
All three types of extension methods have overloads with different parameters. The first parameter is always the key that points to a config entry.

The key parameter must be an existing key in the Tacepao config settings.
The text parameter gives text to the image.. This text will be used on the rendered image. This is the only way to give text to Tecepao (you can not give this attribute in the config file).
The icon, rotation and contentRotation parameters are exactly the same as in the configuration settings.
The sqlParameters parameter should be an anonymous object. This is used if the referenced Tacepao (with the first key parameter) has the command attribute filled. Then this anonymous object's properties will be used as the parameters of that command.
The htmlAttributes is the same parameter as anywhere in MVC. It applies html attributes to the rendered html tag.
There always is an extension method with controller and action parameters. This overload can be used if you do not want to use the default XAMLtoMVC actions.
Below you can find the list of all Tacepao extensions methods.

Extension methods to render <img />

Html.Tacepao(string key, string text)
Html.Tacepao(string key, string text, object sqlParameters, object htmlAttributes)
Html.Tacepao(string key, string text, string icon)
Html.Tacepao(string key, string text, string icon, object sqlParameters, object htmlAttributes)
Html.Tacepao(string key, string text, string icon, double? rotation, double? contentRotation, object sqlParameters, object htmlAttributes)
Html.Tacepao(string controller, string action, string key, string text, double? rotation, double? contentRotation, string icon, object sqlParameters, object htmlAttributes)

Extension methods to render <input type="image" />

Html.TacepaoInput(string key, string text)
Html.TacepaoInput(string key, string text, object sqlParameters, object htmlAttributes)
Html.TacepaoInput(string key, string text, string icon)
Html.TacepaoInput(string key, string text, string icon, object sqlParameters, object htmlAttributes)
Html.TacepaoInput(string key, string text, string icon, double? rotation, double? contentRotation, object sqlParameters, object htmlAttributes)
Html.TacepaoInput(string controller, string action, string key, string text, double? rotation, double? contentRotation, string icon, object sqlParameters, object htmlAttributes)

Extension methods to get Url to an action that renders an image

Url.TacepaoUrl(string key, string text)
Url.TacepaoUrl(string key, string text, object sqlParameters)
Url.TacepaoUrl(string key, string text, string icon)
Url.TacepaoUrl(string key, string text, string icon, object sqlParameters)
Url.TacepaoUrl(string key, string text, string icon, double? rotation, double? contentRotation, object sqlParameters)
Url.TacepaoUrl(string controller, string action, string key, string text, double? rotation, double? contentRotation, string icon,  object sqlParameters)

Last edited Feb 27, 2011 at 1:07 PM by Tocsi, version 9

Comments

No comments yet.