Partial View selection

1 view
Skip to first unread message

Jose

unread,
Jun 25, 2010, 9:11:15 AM6/25/10
to Spark View Engine Dev
Ok I need some help. I'm getting an error trying to render a partial
view

I have a partial view that is used within another view, but I want to
have an action request that partial directly.

So here it is:

the partial is _StatusAssignment.spark

Status.spark uses it like so (this is simplified it actually has more
markup):

<html>
<body>
<StatusAssignment model="SelectedAssignment"/>
</body>
</html>

I have a controller action that does this:

ActionResult StatusAssignment(int? id)
{
var m = Repository.GetByKey(id)
return PartialView(m);
}

The error I get is that it couldn't find the partial
StatusAssignment.spark. But because it's a partial, shouldn't it look
for _StatusAssignment.spark?

I can fix this by altering the action to

ActionResult StatusAssignment(int? id)
{
var m = Repository.GetByKey(id);
ViewData.Model = m;
return PartialView("_StatusAssignment");
}

But that doesn't feel right, what am I doing wrong, should i modify
the SparkViewFactory to add a "_" in the search list?
Reply all
Reply to author
Forward
0 new messages