I'm facing a simple problem to render view within another view .Please help I have a controller and a view using a seperate model rendering dhtmlx scheduler(model is from a dll)
I need to place a listbox that is using a seperate model under the same view. I'm aware that a view is restricted to one model.So I'm confused how to bring my listbox in the sameview of the scheduler. This is my code:
Schedulercontroller.cs
Public Actionresult Index()
{
var scheduler = new DHXScheduler();
...
code
...
return view(scheduler);
}
Index.cshtml
I placed _notes in location
Views/Scheduler/_notes
<div id="dailynotesview">
@* @Url.Action("_notes","Scheduler");*@
@* @{Html.Partial("_notes","Scheduler");}*@
@* @Html.Partial("../Shared/_Dailynote") *@
@{Html.RenderAction("_notes","Scheduler");}
</div>
@Html.Raw(Model.GenerateLinks())
I tried using above methods in views to bring listbox in the same page, but I'm getting the error as follows.
When I use @Html.Partial("../Shared/_notes")
The model item passed into the dictionary is of type 'System.String', but this dictionary requires a model item of type 'Proj.Models.DashboardModel'.
@Url.Action("_notes","Scheduler");
@{Html.RenderAction("_notes","Scheduler");}
I get no error also I don get to see listbox rendered too.I checked with inspect element too.
You can add
List
in your main model as follows,Then in your view you can access it as follows