开发者

ViewDataDictionary passing in Model

开发者 https://www.devze.com 2023-02-10 07:13 出处:网络
using (var writer = new StringWriter()) 开发者_开发问答{ viewPath += (viewName + \".aspx\"); var view = new WebFormView(viewPath);
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);
0

精彩评论

暂无评论...
验证码 换一张
取 消