ashmind.com
域名年龄: 17年2个月1天HTTP/1.1 200 OK 类型:text/html; charset=UTF-8 服务器:Microsoft-IIS/8.5 语言环境:PHP/5.3.26 X-Pingback: http://blog.ashmind.com/xmlrpc.php 访问时间:2016年09月25日 22:32:21 文件大小:95901 网站编码:UTF-8
PagesAboutContactPopularMultiple submit buttons with ASP.NET MVC: final solutionComparing .NET DI (IoC) Frameworks, Part 1Comparing .NET DI (IoC) Frameworks, Part 2Google Reader and Zoho SpreadsheetsProgramming is complex: HTML5 data-*RecentMultiple submit buttons with ASP.NET MVC: final solutionIncludes in BooProjecting unmapped Ids with Linq-to-NHibernateCustom mapping for NHibernate.Search.NET DI (IoC) Frameworks, RevisitedSearchSearch for:Categories.Net (16)AJAX (1)API (1)ASP.Net (3)ASP.NET AJAX (2)ASP.NET MVC (1)Blog (1)Boo (1)Browsers (1)C# (3)C# 3.0 (3)Castle (5)COM Interop (1)Criticism (4)CSS (1)DataBinding (2)Dependency Injection (5)Design Guidelines (1)Fluent (1)Generics (1)Google (1)Google Chrome (2)Hacks (2)History (2)HowTo (3)HTML (3)HTML5 (1)JavaScript (5)Libraries (3)Markup (2)Metaprogramming (2)microformats (3)Mocking (3)Moq (1)MPF (1)MSBuild (1)Naming (1)NHibernate (2)NHibernate.Linq (1)NHibernate.Search (1)NMock2 (2)Reference (4)Solutions (7)Standards (3)Unit Testing (1)Visual Studio (1)WatiN (1)Web (1)Web 2.0 (2)XHTML (1)Zoho (1)MetaLog inEntries RSSComments RSSWordPress.orgMultiple submit buttons with ASP.NET MVC: final solution March 15th, 2010Most people coming to ASP.NET MVC tend to have similar problems. Most of them are related to refreshed understanding of HTML+HTTP limitations. Some are mitigated by ASP.NET MVC (checkboxes), but a lot require custom solutions.One of the more common problems I get asked about by every second person learning MVC is how to make a form with two independent submit buttons, where both should submit the same data, but a have a different processing logic. For example, form may have a Save Draft button and Publish button.Until now, I always said that it is possible, Google/StackOverflow and find out. But I just had to build such kind of thing myself, so I finally took some time to find/build the final solution.So, let’s look at the solutions available online.StackOverflow question “How do you handle multiple submit buttons in ASP.NET MVC Framework?†is the starting point, but it does not provide a good solution for the situation where you need to send same data for both buttons, except the solution to switch by button name, which is duct-taping.Post “ASP.NET MVC – Multiple buttons in the same form†by David Findley is much more interesting, since his AcceptParameterAttribute is very similar to my solution. However, this has several (small) shortcomings: first, you have to specify what is actually an action you want to do in an attribute. So even if you name your action “SaveDraftâ€, you will still need to specify AcceptParameter(Name=“buttonâ€, Value=“saveDraftâ€). Another thing is need to put [ActionName] on your actions, which is understandable, but a bit confusing for people who do not yet know the idea.So, I wanted to build the solution that would require at most one attribute, and where the name of action method corresponds to the attributes of the button. Also, since &
© 2010 - 2020 网站综合信息查询 同IP网站查询 相关类似网站查询 网站备案查询网站地图 最新查询 最近更新 优秀网站 热门网站 全部网站 同IP查询 备案查询
2025-05-05 05:32, Process in 0.0076 second.