Hello, I ran into a situation that I have never ran into before, hoping someone can help.
I have a client that wants to be able to run a totally new ad-hoc report, or pick one from a drop down list. When chosen, it does a foreach through filter criteria objects nested in the report object.
I had some initial trouble, because there was no persisted model, so I created a parent page that is not strongly typed. There is a drop down selector that selects the report and returns an ajax result of a partial view which is strongly typed to the partial view.
So imagine :
MainReportingPage <- ajax form with report selector drop down, javascript to launch a seperate ajax request when drop downs populated on the partial view are changed
ReportDetailsPartialView <- report details, as well as a foreach dynamically building rows of drop downs for the report criteria objects which are nested in a collection on the report object.
It all works great, except for now I need to launch an ajax request with javascript on the main form, passing the currently selected report id along with it to a controller action.
I am doing it with the viewdata which I have tried to populate on the initial form load, and each time the partial view is rendered. The problem is when I issue the AJAX request in javascript from the primary form, the ViewData["reportId"] is the initial report id that is loaded with the form the first time.
My controller action to list the partial view has the following code :
ViewData["reportId"] = selectedReport.REPORT_ID;
return PartialView("ListReportDetails",selectedReport);
This step in the controller for the ajax response of the partial view, never seems to be overwriting the viewdata when i try to use it from javascript. Is there anyway to accomplish overwriting the parent viewdata from the controller? I thought the viewdata was shared between the parent and all partial views, and could be updated in either from the controller.
Thanks for any help you can give!