, , , , , , ViewData . , , . , , - :
ViewData["MasterPageData"] = FunctionToGetData();
- :
<%
if (ViewData["MasterPageData"] != null)
{
Html.RenderPartial("ControlName.ascx", ViewData);
}
%>
Then, in the control, as well as on the normal viewing page, do the following:
<% var categories = (CastIfNeeded)ViewData["MasterPageData"]; %>
process as normal...
I have not yet had to transfer data to the main page, but I would have thought that you would. More details here.
EDIT: Modified it a bit to reflect what I'm doing in my current project.
source
share