首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏james大数据架构

    MVC利用MvcHtmlString在后台生成HTML

    /// <param name="selectedValue"></param> /// <returns></returns> public static MvcHtmlString >{1}</option>", i.ID, i.Name); } sb.Append("</select>"); return MvcHtmlString.Create summary> /// <param name="html"></param> /// <returns></returns> public static MvcHtmlString

    1.3K60发布于 2018-01-22
  • 来自专栏大内老A

    ASP.NET MVC路由扩展:链接和URL的生成

    1: public static class LinkExtensions 2: { 3: //其他成员 4: public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper, string linkText, string actionName); 5: public static MvcHtmlString string hostName, string fragment, object routeValues, object htmlAttributes); 13: public static MvcHtmlString 1: public static class LinkExtensions 2: { 3: //其他成员 4: public static MvcHtmlString RouteLink(this HtmlHelper htmlHelper, string linkText, string routeName); 6: public static MvcHtmlString

    2.5K70发布于 2018-01-15
  • 来自专栏大内老A

    [ASP.NET MVC]为HtmlHelper添加一个RadioButtonList扩展方法

    1: public static class RadioButtonListExtensions 2: { 3: public static MvcHtmlString RadioButtonList GenerateHtml(name, codes, repeatDirection, htmlAttributes, null); 7: } 8: public static MvcHtmlString fullHtmlFieldName, codes, repeatDirection, htmlAttributes, stateValue); 22: } 23: private static MvcHtmlString table.InnerHtml += tr.ToString(); 51: } 52: } 53: return new MvcHtmlString

    1.2K110发布于 2018-01-16
  • 来自专栏木宛城主

    ASP.NET MVC使用Bootstrap系列(5)——创建ASP.NET MVC Bootstrap Helpers

    要创建静态方法,你可以按照如下步骤来实现: 添加命了Helpers的文件夹 创建如下枚举类 public class ButtonHelper    { public static MvcHtmlString = Enums.ButtonSize.Normal)            { return new MvcHtmlString(string.Format("<button type "xs"; break;            } return bootstrapSize;        }    } Button方法返回了一个MvcHtmlString public static MvcHtmlString BootstrapButton(this HtmlHelper helper, string caption, Enums.ButtonStyle = Enums.ButtonSize.Normal)             { return new MvcHtmlString(string.Format("<button type

    2.2K80发布于 2018-01-11
  • 来自专栏大内老A

    ASP.NET MVC的Model元数据与Model模板:将”ListControl”引入ASP.NET MVC

    1: public static class ListControlExtensions 2: { 3: //其他成员 4: public static MvcHtmlString 而RadioButtonList和MvcHtmlString最终调用了辅助方法RadioButtonCheckBoxList显示了最终的HTML生成,该方法定义如下。 1: public static class ListControlExtensions 2: { 3: public static MvcHtmlString CheckBoxWithValue (element.ToString()); 32: } 33:  34: private static MvcHtmlString RadioButtonCheckBoxList (HtmlHelper htmlHelper, string listName, Func<ListItem, MvcHtmlString> elementHtmlAccessor) 35:

    5.8K60发布于 2018-01-15
  • 来自专栏大内老A

    在ASP.NET MVC中使用“RadioButtonList”和“CheckBoxList”

    1: public static class ListControlExtensions 2: { 3: public static MvcHtmlString RadioButtonList ListControlUtil.GenerateHtml(name, codes, repeatDirection,"radio",null); 7: } 8: public static MvcHtmlString fullHtmlFieldName, codes, repeatDirection, "radio", metadata.Model); 15: } 16:  17: public static MvcHtmlString ListControlUtil中生成相关Html的逻辑定义如下: 1: public static class ListControlUtil 2: { 3: public static MvcHtmlString table.InnerHtml += tr.ToString(); 58: } 59: } 60: return new MvcHtmlString

    1.6K80发布于 2018-01-16
  • 来自专栏圣杰的专栏

    Asp.net mvc 知多少(三)

    public static class CustomHelpers { //Submit Button Helper public static MvcHtmlString SubmitButton string buttonText) { string str = "<input type=\"submit\" value=\"" + buttonText + "\"/>"; return new MvcHtmlString (str); } //Readonly Strongly-Typed TextBox Helper public static MvcHtmlString TextBoxFor<TModel, TValue this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel,TValue>>expression, bool isReadonly) { MvcHtmlString html = default(MvcHtmlString); if (isReadonly) { html = System.Web.Mvc.Html.InputExtensions.TextBoxFor

    3.4K60发布于 2018-01-11
  • 来自专栏大内老A

    Model验证系统运行机制是如何实现的?

    1: public static class ValidationExtensions 2: { 3: //其他成员 4: public static MvcHtmlString ValidationMessage(this HtmlHelper htmlHelper, string modelName); 5: public static MvcHtmlString 1: public static class ValidationExtensions 2: { 3: //其他成员 4: public static MvcHtmlString ValidationSummary(this HtmlHelper htmlHelper); 5: public static MvcHtmlString ValidationSummary (this HtmlHelper htmlHelper, string message); 7: public static MvcHtmlString ValidationSummary

    2.2K110发布于 2018-01-15
  • 来自专栏大内老A

    [ASP.NET MVC]通过对HtmlHelper扩展简化“列表控件”的绑定

    1: public static class SelectExtensions 2: { 3: public static MvcHtmlString DropDownList(this htmlHelper.DropDownList(name, listItems, bindingOption.OptionalLabel); 8: } 9: public static MvcHtmlString TProperty>(expression, listItems,bindingOption.OptionalLabel); 14: } 15:  16: public static MvcHtmlString htmlHelper.ListBox(name, listItems, bindingOption.OptionalLabel); 21: } 22: public static MvcHtmlString

    1.8K60发布于 2018-01-16
  • 来自专栏葡萄城控件技术团队

    七天学会ASP.NET MVC (五)——Layout页面使用和用户角色管理

    Html.RenderPartial会将分部View的结果直接写入HTTP 响应流中,而 Html.Partial会返回 MvcHtmlString值。 什么是MvcHtmlString,为什么 Html.Partial返回的是MvcHtmlString 而不是字符串? 根据MSDN规定,”MvcHtmlString”代表了一个 HTML编码的字符串,不需要二次编码。 当不适用razor编码时,使用 MvcHtmlStringMvcHtmlString是razor的一种表示,即“字符串已经编码完毕,不需要其他编码”。 Html.RenderAction会将Action 方法的执行结果直接写入HTTP 响应请求流中,而 Html.Action会返回MVCHTMLString

    5.8K80发布于 2018-01-10
  • 来自专栏大内老A

    ASP.NET MVC以ValueProvider为核心的值提供系统: DictionaryValueProvider

    1: public static class ChildActionExtensions 2: { 3: //其他成员 4: public static MvcHtmlString Action(this HtmlHelper htmlHelper, string actionName); 5: public static MvcHtmlString Action( this HtmlHelper htmlHelper, string actionName, object routeValues); 6: public static MvcHtmlString HtmlHelper htmlHelper, string actionName, RouteValueDictionary routeValues); 8: public static MvcHtmlString htmlHelper, string actionName, string controllerName, object routeValues); 9: public static MvcHtmlString

    2.5K80发布于 2018-01-15
  • 来自专栏james大数据架构

    MVC发布后项目存在于根目录中的子目录中时的css与js、图片路径问题

    id="+id+"&type="+type)) @Html.Encode()对输出内容编码,防止攻击 原样输出HTML str="

    dddd
    " @MvcHtmlString.Create

    2.4K100发布于 2018-01-22
  • 来自专栏全栈程序员必看

    html.dropdownlistfor_see的用法

    MvcNHibernateFirst.Web.Extensions { public static class SelectExtension { public static MvcHtmlString return DDLDeptOu(htmlHelper, name, null, htmlAttributes); } public static MvcHtmlString

    1K30编辑于 2022-11-07
  • 来自专栏calvin

    扩展htmlhelper.DropDownListFor 支持list数据源和option增加属性

    1 public static MvcHtmlString DropDownListForEx<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper } 33 34 tag.InnerHtml = optionsHtml.ToString(); 35 return new MvcHtmlString

    99520发布于 2018-11-20
  • 来自专栏全栈程序员必看

    cshtml标记html5,cshtml常用标签

    RenderSection(“PageSpecificStyleSheetIncludes”, required: false) @Html.Partial:在布局页中,把一个个View给镶入进来并回传的一个Object (MvcHtmlString

    1.9K20编辑于 2022-09-07
  • 来自专栏大内老A

    利用ASP.NET SiteMap生成与Bootstrap"兼容"菜单

    1: public static class BootstrapMenuExtensions 2: { 3: public static MvcHtmlString SiteMap.Providers.Cast<SiteMapProvider>().First(); 8: return new MvcHtmlString( RenderMenu

    2.1K100发布于 2018-01-15
  • 来自专栏大内老A

    这算是ASP.NET MVC的一个大BUG吗?

    public static class InputExtensions { private static MvcHtmlString InputHelper(HtmlHelper htmlHelper bool isExplicitValue, string format, IDictionary<string, object> htmlAttributes); } private static MvcHtmlString

    1.1K80发布于 2018-01-15
  • 2025年ASP.NET MVC应用场景面试题

    public static class HtmlHelperExtensions { public static MvcHtmlString CustomButton(this HtmlHelper htmlHelper, string text) { return new MvcHtmlString($"<button>{text}</button>"); } }

    21910编辑于 2025-11-14
  • 来自专栏ASP.NET MVC5 后台权限管理系统

    构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(14)-EasyUI缺陷修复与扩展

    Suggestion.PlaseChooseToOperatingRecords' 7.工具栏的增、删、改按钮一样每次粘贴的代码也不少,我们应该扩展Mvc的HtmlHelper的封装,之后我们@html.就出来了多方便,以后还用于权限控制   这个必须返回MvcHtmlString /// <param name="hr">分割线</param> /// <returns>html</returns> public static MvcHtmlString sb.Append("

    "); } return new MvcHtmlString

    1K60发布于 2018-01-16
  • 来自专栏熊二哥

    快速入门系列--MVC--06视图

    文件名为:ASP_Page_views_XXX_ActionXXX_cshtml 程序集名由代码可知: 1 public static MvcHtmlString ListViewAssemblies AppDomain.CurrentDomain.GetAssemblies().Where(a => a.FullName.StartsWith("App_Web_"))) 5 { 6 //omit 7 } 8 return new MvcHtmlString

    1.8K100发布于 2018-01-24
领券