this is the master page :
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="header1" runat="server" />
</head>
<body>
<div class="page">
<div id="header">
<div id="title">
<h1>My MVC Application</h1>
</div>
<div id="logindisplay">
<% Html.RenderPartial("LogOnUserControl"); %>
</div>
<div id="menucontainer">
<ul id="menu">
<li><%= Html.ActionLink("Home", "Index", "Home")%></li>
<li><%= Html.ActionLink("About", "About", "Home")%></li>
<li><%= Html.ActionLink("Imoveis", "Index", "Categoria")%></li>
<li><%= Html.ActionLink("Admin", "Index", "Admin")%></li>
<li><%= Html.ActionLink("User", "Index", "User")%></li>
</ul>
</div>
</div>
<div id="left">
<% Html.RenderPartial("~/Views/Imovel/Pesquisa.ascx"); %>
</div>
<div id="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
<div id="footer">
</div>
</div>
</div>
</body>
</html>
Partial View
<%= Html.DropDownList("categoria_id", (SelectList)ViewData["Categoriass"], "--Selecciona um--")%>
<div class="editor-label">
<%= Html.LabelFor(model => model.categoria_id) %>
</div>
<div class="editor-field">
<%= Html.DropDownListFor(model => model.categoria_id, (SelectList)ViewData["Categorias"], "--Selecciona um--")%>
<%= Html.ValidationMessageFor(model => model.categoria_id) %>
</div>
This is the problem:
public ActionResult Index()
{
ViewData["Message"] = "Welcome to ASP.NET MVC!";
**ViewData["Categoriass"] = new SelectList(catRepository.FindAllCategorias().AsEnumerable(), "id", "nome", 3);**
return View();
}
Since the partial view is in the master page, how do I get its model?