惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Project Zero
Project Zero
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
T
The Blog of Author Tim Ferriss
S
SegmentFault 最新的问题
量子位
V
Visual Studio Blog
F
Full Disclosure
博客园 - 叶小钗
Recent Announcements
Recent Announcements
G
Google Developers Blog
博客园 - Franky
F
Fortinet All Blogs
有赞技术团队
有赞技术团队
B
Blog
aimingoo的专栏
aimingoo的专栏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
N
Netflix TechBlog - Medium
L
LINUX DO - 最新话题
S
Security @ Cisco Blogs
Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
Cloudbric
Cloudbric
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
云风的 BLOG
云风的 BLOG
阮一峰的网络日志
阮一峰的网络日志
N
News and Events Feed by Topic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
T
Troy Hunt's Blog
P
Proofpoint News Feed
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Jina AI
Jina AI
PCI Perspectives
PCI Perspectives
Martin Fowler
Martin Fowler
O
OpenAI News
Hacker News: Ask HN
Hacker News: Ask HN
S
Secure Thoughts
P
Privacy International News Feed
I
InfoQ
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - skylai

WCF学习之旅(一)---Hello World. WCF Client configuration Jquery表单验证 Jquery的一些常用信息 二进制、SOAP的序列化及反序列化 简单的Attribute实现. 泛型之泛型约束 C#泛型之泛型委托 C#2.0泛型介绍之简单泛型类。 序列化之XML序列化(一) Vs2005的win form动态生成菜单 强制字符换行CSS版和C#版 js操作xml 读写XML文件 js的一些杂谈 一个button同时执行多个有返回值的函数的解决方法(return false; or return true;) DataGrid里应用radio单选按钮 限制字符输入(ASCII 码) 前两天刚看书看到的,来这里跟大家分享一下有关C#处理指令的问题
mvc3 小技巧
skylai · 2012-02-04 · via 博客园 - skylai

1.在客户端的CS代码中增加HTML元素,对字符进行编码。

@Html.Raw(" ")

2.AJAX 链接

@Ajax.ActionLink("ajax link","index","home",new { a=3,b=3},new AjaxOptions{ UpdateTargetId="main"}) 

3.         /// <summary>

        /// 描述:输出PartialView HTML 字符串
        
/// </summary>
        
/// <param name="controller"></param>
        
/// <param name="partialViewName">部分视图文件名</param>
        
/// <returns></returns>
        protected static string RenderPartialViewToString(Controller controller, string partialViewName)
        {
            IView view = ViewEngines.Engines.FindPartialView(controller.ControllerContext, partialViewName).View;
            using (StringWriter writer = new StringWriter())
            {
                ViewContext viewContext = new ViewContext(controller.ControllerContext, view, controller.ViewData, controller.TempData, writer);
                viewContext.View.Render(viewContext, writer);
                return writer.ToString();
            }
        }

        /// <summary>
        
/// 描述:输出View HTML 字符串
        
/// </summary>
        
/// <param name="controller"></param>
        
/// <param name="viewName">视图文件名</param>
        
/// <param name="masterName">母板页文件名</param>
        
/// <returns></returns>
        protected static string RenderViewToString(Controller controller, string viewName, string masterName)
        {
            IView view = ViewEngines.Engines.FindView(controller.ControllerContext, viewName, masterName).View;
            using (StringWriter writer = new StringWriter())
            {
                ViewContext viewContext = new ViewContext(controller.ControllerContext, view, controller.ViewData, controller.TempData, writer);
                viewContext.View.Render(viewContext, writer);
                return writer.ToString();
            }
        }

4.a标签有javascript:void(0);的效果,在onclick后加return false.就可以。

<a onclick="updateStatus('11156','0');return false;" href="/Res_Item/Index.aspx" class="button">待发布</a>