2011-02-10 36 views
0
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

回答

0

我不認爲你需要在這條線

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