Bill Crawley
Jul 29th, 2011, 06:01 AM
Hi All,
In one of my actions I set a hidden view data Object:
Setting in the Controller:
IEnumerable<ComputerBreakdownRiskViewModel.CoverType> coverFlatData = _gridService.PopChildGrid(RiskID, PolicyZoneID, SectionID);
ViewData["GridValues"] = coverFlatData;....
declaration in the view:
@Html.Hidden("GridValues", ViewData["GridValues"])
On a call from my view back to my controller I attempt to pass the viewdata Value:
......Update("_SaveAjaxEditing", "ComputerBreakdownRisk", new { ViewData["GridValues"], Model.Covers });
Back in my controller action I make the signature:
public ActionResult _SaveAjaxEditing(int Id, IEnumerable<ComputerBreakdownRiskViewModel.CoverType> GridValues, ComputerBreakdownRiskViewModel.CoverType cover)
{....
I declare it as IEnumerable since this was the type that I set the ViewData up with, however i Receive the following error:
Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.
In one of my actions I set a hidden view data Object:
Setting in the Controller:
IEnumerable<ComputerBreakdownRiskViewModel.CoverType> coverFlatData = _gridService.PopChildGrid(RiskID, PolicyZoneID, SectionID);
ViewData["GridValues"] = coverFlatData;....
declaration in the view:
@Html.Hidden("GridValues", ViewData["GridValues"])
On a call from my view back to my controller I attempt to pass the viewdata Value:
......Update("_SaveAjaxEditing", "ComputerBreakdownRisk", new { ViewData["GridValues"], Model.Covers });
Back in my controller action I make the signature:
public ActionResult _SaveAjaxEditing(int Id, IEnumerable<ComputerBreakdownRiskViewModel.CoverType> GridValues, ComputerBreakdownRiskViewModel.CoverType cover)
{....
I declare it as IEnumerable since this was the type that I set the ViewData up with, however i Receive the following error:
Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.