ViewDataDictionary passing in Model
using (var writer = new StringWriter())
开发者_开发问答 {
viewPath += (viewName + ".aspx");
var view = new WebFormView(viewPath);
var vdd = new ViewDataDictionary<T>(indication.Model);
var viewCxt = new ViewContext(ControllerContext, view, vdd, new TempDataDictionary(), writer);
viewCxt.View.Render(viewCxt, writer);
return Json(
new {
html = writer.ToString()
});
}
Error is:
Error 66 The best overloaded method match for 'System.Web.Mvc.ViewDataDictionary<T>.ViewDataDictionary(T)' has some invalid arguments C:\SVN\k2\AppTeamTrunk\web\Chatham.Web\Controllers\IndicationsController.cs 318 39 Chatham.Web
I'm not sure how to get the view to render passing in the model.
Any help?
I dont think you need the <T>
argument on this line
var vdd = new ViewDataDictionary<T>(indication.Model);
精彩评论