Thursday, July 3, 2014

a FormCollection may help reverse engineer what is coming back from a form post in an ASP.NET MVC application

This is some nasty stuff from MVC1 that you usually don't want to do.

[HttpPost]
public ActionResult Index(FormCollection formCollection)
{
   Dictionary<string, string> collection = formCollection.Keys.Cast<string>()
         .ToDictionary(key => key, key => formCollection[key]);
   Session["collection"] = collection;
   return View();
}

 
 

In just glancing at the HTML a DevExpress TreeList makes, I would not have been able to tell that TreeList$Sel (that is the name parameter on a hidden type input tag with an id parameter of TreeList_Sel) held the selections at the TreeList.

No comments:

Post a Comment