MVC5 方法扩展
public static MvcHtmlString DataDictionaryDropDownList(this HtmlHelper htmlHelper, string name, object htmlAttributes, List<SelectListItem> selectListItem)
{
return SelectExtensions.DropDownList(htmlHelper, name, selectListItem, htmlAttributes);
} public static MvcHtmlString DataDictionaryDropDownList(this HtmlHelper htmlHelper, string name, string dataKeyName, object htmlAttributes, string checkedValue = null, IDataDictionaryAdapter adapter = null, params SelectListItem[] moreSelectItem)
{
//默认适配器
if (adapter == null) adapter = new DataDictionaryAdapter(); List<SelectListItem> selectListItem = adapter.GetSelectListItem(dataKeyName, checkedValue); //添加更多选择
if (moreSelectItem != null) selectListItem.InsertRange(, moreSelectItem); return DataDictionaryDropDownList(htmlHelper, name, htmlAttributes, selectListItem);
}
public static MvcHtmlString DataDictionaryDropDownList<T>(this HtmlHelper htmlHelper, string name, string dataKeyName, object htmlAttributes, string checkedValue = null, IDataDictionaryAdapter adapter = null, Action<T> beforeAction = null, params SelectListItem[] moreSelectItem)
{
//默认适配器
if (adapter == null) adapter = new DataDictionaryAdapter(); List<SelectListItem> selectListItem = adapter.GetSelectListItem<T>(dataKeyName, checkedValue, beforeAction); //添加更多选择
if (moreSelectItem != null) selectListItem.InsertRange(, moreSelectItem); return DataDictionaryDropDownList(htmlHelper, name, htmlAttributes, selectListItem);
} public static MvcHtmlString ActionLink2(this HtmlHelper htmlHelper, string linkText, string actionName, object routeValues, object htmlAttributes)
{
MvcHtmlString result = LinkExtensions.ActionLink(htmlHelper, linkText, actionName, routeValues, htmlAttributes);
return HtmlDecode(result);
}
public static MvcHtmlString ActionLink2(this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, object htmlAttributes)
{
MvcHtmlString result = LinkExtensions.ActionLink(htmlHelper, linkText, actionName, controllerName, null, htmlAttributes);
return HtmlDecode(result);
}
public static MvcHtmlString ActionLink2(this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, object routeValues, object htmlAttributes)
{
MvcHtmlString result = LinkExtensions.ActionLink(htmlHelper, linkText, actionName, controllerName, routeValues, htmlAttributes);
return HtmlDecode(result);
} private static MvcHtmlString HtmlDecode(MvcHtmlString mvcHtmlString)
{
return new MvcHtmlString(HttpUtility.HtmlDecode(mvcHtmlString.ToHtmlString()));
}
MVC5 方法扩展的更多相关文章
- String对象方法扩展
/** *字符串-格式化 */ String.prototype.format = function(){ var args = arguments;//获取函数传递参数数组,以便在replace回调 ...
- .NET:不要使用扩展方法扩展Object对象。
C#的扩展方法算是一种Minin(掺入)机制,掺入方法有其合理的使用场景,这里说说一种不好的使用场景(个人意见):不要使用扩展方法扩展Object对象.扩展Object会对所有类型的示例有侵入,特别是 ...
- javascript方法扩展
String.prototype.startWith = function(str){ return str.indexOf(str) == 0; }; var str = "abc&quo ...
- jQuery扩展$.fn、$.extend jQery命名方法扩展 练习总结
<script> $.fn.hello = function(){ //扩展jQuery实例的自定义方法,基于$.fn的jq方法扩展 this.click(function(){ ...
- 原生js事件委托(事件代理)方法扩展
原生js事件委托(事件代理)方法扩展: 通过Node底层原型扩展委托方法 /** * 事件委托方法 * @param eventName {string}:事件名称,如'click' * @param ...
- jQuery全局进行方法扩展
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>01 ...
- jQuery对象进行方法扩展
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>01 ...
- .NET MVC5+ Dapper+扩展+AutoFac自动注入实现
1.首先创建一个MVC项目 定义Model 层 view 层 index.cshtml 控制器层Controllers等文件 2.在线安装或者引用dapper 以及扩展相关包 同时Autofac ...
- js数组方法扩展
/** * Created by Administrator on 2016/9/1. */ //数组去重 Array.prototype.unique = function(){ this.sort ...
随机推荐
- python模块之time_random
把老师的资料放在最上面: 参考: http://www.cnblogs.com/yuanchenqi/articles/5732581.html 导入模块的方法: #!/usr/bin/env pyt ...
- mysql 5.7安装图解 mysql 5.7图文安装完整教程
今天给搭建分享一个教程,mysql 5.7的安装操作,这里呢我叫大家怎么用二进制去安装mysql,其实在大多数的生产环境中使用二进制预编译的安装方式是最多了,下面大家跟着我的步骤去尝试着安装下吧. 先 ...
- pytorch 读数据接口 制作数据集 data.dataset
[吐槽] 啊,代码,你这个大猪蹄子 自己写了cifar10的数据接口,跟官方接口load的数据一样, 沾沾自喜,以为自己会写数据接口了 几天之后,突然想,自己的代码为啥有点慢呢,这数据集不大啊 用了官 ...
- beifen
Comparison of Models for Predicting the Outcome of Craniocerebral Injury by Using Machine Learning ...
- Linux中挂载详解以及mount命令用法
转自:https://blog.csdn.net/daydayup654/article/details/78788310 挂载概念 Linux中的根目录以外的文件要想被访问,需要将其“关联”到根目录 ...
- CSS组合设计输入框和按钮生成自定义关键字查询栏
效果图: html代码: <!DOCTYPE html> <head> <title></title> </head> <body&g ...
- plsql插入数据出现乱码问题
今天在使用plsql 插数据时 ,遇到的问题就是插入进去是乱码问题,在这里总结一下如何解决的 首先声明一下就是: 现在只有客户端,没有服务端,有一些需求就是总是有许多数据要插入进去,但是在使用sql语 ...
- 安装activeMQ(window,linux系统)
今天学习了activeMQ服务器,把它说成成服务器是我的理解,,呵呵,首先,说一下它的安装, 官网:http://activemq.apache.org/overview.html window下的安 ...
- Mac 安装Python3 facewap环境
参考网上大神的方法 1 官网下载安装 2 下载指定版本的源码cmake安装 3 Mac上使用homebrew进行安装(强烈推荐,主要是前两种的openssl模块我没有搞定链接什么的一直报错,一个个下载 ...
- 2018上C语言程序设计(高级)作业- 第4次作业成绩及总结
作业地址 https://edu.cnblogs.com/campus/hljkj/CS2017-01/homework/1842 评分准则 第4次作业各项成绩包括三项: 完成WC项目:60分:基本功 ...