{"id":4282,"date":"2014-03-30T09:40:47","date_gmt":"2014-03-30T09:40:47","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/c-mvc4-actionresult-actionfilter-for-formcollection-collection-of-common-programming-errors\/"},"modified":"2014-03-30T09:40:47","modified_gmt":"2014-03-30T09:40:47","slug":"c-mvc4-actionresult-actionfilter-for-formcollection-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/c-mvc4-actionresult-actionfilter-for-formcollection-collection-of-common-programming-errors\/","title":{"rendered":"C# MVC4 ActionResult ActionFilter for FormCollection-Collection of common programming errors"},"content":{"rendered":"<p>I have the following ActionResults and one is meant to be an override of the other that accepts a FormCollection as a parameter.<\/p>\n<pre><code>   [HttpPost]\n    public ActionResult PartialAverageDisplay()\n    {\n        HomeModel C = new HomeModel();\n        ChViewModel D = new ChViewModel();\n        D = C.AverageCalculation();\n\n        return PartialView(D);\n    }\n   [HttpPost]\n    public ActionResult PartialAverageDisplay(FormCollection myFcollection)\n    {\n         HomeModel C = new HomeModel();\n         System.Data.DataTable myDT = new System.Data.DataTable();\n         myDT = (DataTable)Session[\"DT\"];\n         ChViewModel D = new ChViewModel();\n         D = C.AverageCalculation(myDT, myFcollection);\n\n            return PartialView(D);\n        }\n<\/code><\/pre>\n<p>I&#8217;ve been unable to find an example online of how to create an actionfilter attribute for requiring a FormCollection. Everything Ive seen has used an array of strings. Im not experienced with creating actionfilters. Can anyone explain to me how to approach this?<\/p>\n<p>Thanks<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have the following ActionResults and one is meant to be an override of the other that accepts a FormCollection as a parameter. [HttpPost] public ActionResult PartialAverageDisplay() { HomeModel C = new HomeModel(); ChViewModel D = new ChViewModel(); D = C.AverageCalculation(); return PartialView(D); } [HttpPost] public ActionResult PartialAverageDisplay(FormCollection myFcollection) { HomeModel C = new HomeModel(); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4282","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4282"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4282\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}