的ViewDataDictionary传递模型

问题描述:

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() 
            }); 
         } 

错误是:的ViewDataDictionary传递模型

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 

我不知道如何获取视图渲染传递模型。

任何帮助?

+0

什么是你想在这里做的<T>说法? – bzlm 2011-02-10 21:01:54

我不认为你需要在这条线

var vdd = new ViewDataDictionary<T>(indication.Model);