zoukankan      html  css  js  c++  java
  • Microsoft.Web.Mvc Assembly 说明

    IHtmlElement

     A Html Element's Interface.
    Html标签的一个接口规范。 C#:

    public interface IHtmlElement
    {
        
    // Properties
        IDictionary<stringstring> Attributes { get; }
        
    string InnerHtml { getset; }
        
    string TagName { get; }
    }

    ButtonBuilder

    To Builter a Button HTML tag with some attr.
    用一些属性来构造Button的Html标签的构造器。
    C#:
    public static class ButtonBuilder
    {
        
    // Methods
        public static IHtmlElement Button(string name, string buttonText, string onClickMethod, IDictionary<stringobject> htmlAttributes);
        
    public static IHtmlElement SubmitButton(string name, string buttonText, IDictionary<stringobject> htmlAttributes);
        
    public static IHtmlElement SubmitImage(string name, string sourceUrl, IDictionary<stringobject> htmlAttributes);
    }

    
    

    RequireHttpMethodAttribute

    Base Class:ActionFilterAttribute
    可以批量设置可用的Action的列表。


    [RequireHttpMethod("index","about")]
    public class HomeController{}

    则只有home/index与home/about是可以访问的。

    ViewExtensions

    HtmlHelperViewPage的扩展
    增加了RenderAction及RenderRoute的扩展
    定义
    public static class ViewExtensions
    {
        
    // Methods
        public static void RenderAction<TController>(this HtmlHelper helper, Expression<Action<TController>> action) where TController: Controller;
        
    public static void RenderAction(this HtmlHelper helper, string actionName);
        
    public static void RenderAction(this HtmlHelper helper, string actionName, string controllerName);
        
    public static void RenderAction(this HtmlHelper helper, string actionName, string controllerName, object values);
        
    public static void RenderAction(this HtmlHelper helper, string actionName, string controllerName, RouteValueDictionary values);
        
    public static void RenderRoute(this HtmlHelper helper, RouteValueDictionary values);
    }




    使用方法:



    <%=Html.RenderUserControl("~/views/user/index-account.ascx", ViewData.Model)%>



    MailToExtensions

    增加了HtmlHelper的MailTo方法:



    可以支持默认的转发及设置标题内容



    public static class MailToExtensions
    {
        
    // Methods
        public static string Mailto(this HtmlHelper helper, string linkText, string emailAddress);
        
    public static string Mailto(this HtmlHelper helper, string linkText, string emailAddress, IDictionary<stringobject> htmlAttributes);
        
    public static string Mailto(this HtmlHelper helper, string linkText, string emailAddress, object htmlAttributes);
        
    public static string Mailto(this HtmlHelper helper, string linkText, string emailAddress, string subject);
        
    public static string Mailto(this HtmlHelper helper, string linkText, string emailAddress, string subject, IDictionary<stringobject> htmlAttributes);
        
    public static string Mailto(this HtmlHelper helper, string linkText, string emailAddress, string subject, object htmlAttributes);
        
    public static string Mailto(this HtmlHelper helper, string linkText, string emailAddress, string subject, string body, string cc, string bcc, IDictionary<stringobject> htmlAttributes);
        
    public static string Mailto(this HtmlHelper helper, string linkText, string emailAddress, string subject, string body, string cc, string bcc, object htmlAttributes);
    }

    ImageExtensions

    HtmlHelepr的图片显示扩展:



    public static class ImageExtensions
    {
        
    // Methods
        public static string Image(this HtmlHelper helper, string imageRelativeUrl);
        
    public static IHtmlElement Image(string imageUrl, string alt, IDictionary<stringobject> htmlAttributes);
        
    public static string Image(this HtmlHelper helper, string imageRelativeUrl, IDictionary<stringobject> htmlAttributes);
        
    public static string Image(this HtmlHelper helper, string imageRelativeUrl, object htmlAttributes);
        
    public static string Image(this HtmlHelper helper, string imageRelativeUrl, string alt);
        
    public static string Image(this HtmlHelper helper, string imageRelativeUrl, string alt, IDictionary<stringobject> htmlAttributes);
        
    public static string Image(this HtmlHelper helper, string imageRelativeUrl, string alt, object htmlAttributes);
    }

    ButtonsAndLinkExtensions

    HtmlHelper的扩展



    增加了Button,SubmitButton,SubmitButton的支持



    public static class ButtonsAndLinkExtensions
    {
        
    // Methods
        public static string Button(this HtmlHelper helper, string name, string buttonText, string onClickMethod);
        
    public static string Button(this HtmlHelper helper, string name, string buttonText, string onClickMethod, IDictionary<stringobject> htmlAttributes);
        
    public static string Button(this HtmlHelper helper, string name, string buttonText, string onClickMethod, object htmlAttributes);
        
    public static string SubmitButton(this HtmlHelper helper);
        
    public static string SubmitButton(this HtmlHelper helper, string name);
        
    public static string SubmitButton(this HtmlHelper helper, string name, string buttonText);
        
    public static string SubmitButton(this HtmlHelper helper, string name, string buttonText, IDictionary<stringobject> htmlAttributes);
        
    public static string SubmitButton(this HtmlHelper helper, string name, string buttonText, object htmlAttributes);
        
    public static string SubmitImage(this HtmlHelper helper, string name, string imageSrc);
        
    public static string SubmitImage(this HtmlHelper helper, string name, string imageSrc, IDictionary<stringobject> htmlAttributes);
        
    public static string SubmitImage(this HtmlHelper helper, string name, string imageSrc, object htmlAttributes);
    }

    Wiki:http://www.eice.com.cn/Microsoft_Web_Mvc.ashx

  • 相关阅读:
    【免费】承接各类SharePoint项目开发工作
    数据仓库(一)Introduction
    几种极其隐蔽的XSS注入的防护
    Google SEO优化技术的12个要点总结
    数据结构算法必备
    算法数据结构
    python发邮件
    MySQL数据库中的Date,DateTime,TimeStamp和Time类型
    使用.htaccess实现301重定向
    SharePoint 2010 初次安装时使用向导启动的服务
  • 原文地址:https://www.cnblogs.com/chsword/p/Microsoft_Web_Mvc.html
Copyright © 2011-2022 走看看