日期:2014-05-17  浏览次数:20467 次

请问mvc3中,使用html.partial()时候,如何与宿主分用2个不同的model
如:
a.cshtml:

         <body>
           @model1
           @html.partial(b.cshtml)
         </body>

b.cshtml:
          <div>@model2</div>
________________________________________
a在controller中
a.cs:
     public ActionResult a()
{

   model1 m1;
   model2 m2;
  return view();

}

请问a.cs中return该怎么写才能retrun2个model,然后怎么在view层使用
------解决方案--------------------
不管用什么方法,你要告诉b用哪个model
m1.property=m2
return view(m1);

@html.partial(b.cshtml,Model.property)

  
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/