Passing data to multiple user controls
-
Hello, I have a controller class like below: public class CompanyController : Controller { public ActionResult Index() { ViewData["Message"] = "Company List"; ViewData["Company"] = CompanyDataContext.GetCompanyByCategory(1).AsEnumerable();//dataContext.Persons.ToList(); return View(ViewData["Company"]); } ... ... The view has the below code <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site2.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Review.Models.Company>>" %> <% foreach (var item in Model) { %> <% Html.RenderPartial("~/Views/Shared/List.ascx", item); %> <% } %> ... Now if I want another user control on the same view with with different data how can I do it? Like Below <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site2.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Review.Models.Company>>" %> Html.RenderPartial("~/Views/Shared/GetNames.ascx", item); %> <% foreach (var item in Model) { %> <% Html.RenderPartial("~/Views/Shared/List.ascx", item); %> <% } %> ...
Regards, Pavas