开发杂记-潦草整理

by kevin 2. 九月 2014 23:15 >
  • css的float会将display为inline或者block的元素,修改成display:inline-block
  • razor.parse 每次都会重新编译模板文件,这样做很耗资源(内存和CPU)
  • Html.RenderPartial其实也是比较耗资源的
  • javascript,多个空格合并成一个:
   1: string = string.replace(/\s{2,}/g, ' ');
  • asp.net mvc,使用 razor模板引擎,让方法返回的字符串不会被进行Html编码:
   1: public static IHtmlString BeginScript(this HtmlHelper htmlHelper)
   2: {
   3:    return new HtmlString("<script type=\"text/javascript\">");
   4: }
   5:  
   6: public static IHtmlString EndScript(this HtmlHelper htmlHelper)
   7: {
   8:     return new HtmlString("</script>");
   9: }
  • 导出Excel中出现乱码的终极解决方案:
   1: <meta http-equiv="content-type" content="application/ms-excel; charset=UTF-8"/>
   2: <table>
   3:     <tr>
   4:         <td>cbcye@live.com | http://www.cbcye.com </td>
   5:     </tr>
   6: <table> 
分享到: 更多

打赏请我喝果汁咯

支付宝 微信

关于我

80后,单身,平庸的程序员。

喜欢看书,乐于交友,向往旅游。

遇建Kevin

FluentData交流群:477926269

Fluentdata