有没有办法在将模型传递给Partial视图的同时传递一些额外的数据?
例如:
例如:
@Html.Partial("_SomeTable", (List<CustomTable>)ViewBag.Table);
这是我现在拥有的。我能否添加其他内容而不更改我的模型?
@Html.Partial("_SomeTable", (List<CustomTable>)ViewBag.Table, "TemporaryTable");
我看到ViewDataDictionary作为参数。我不确定这个对象的作用或者它是否符合我的需求。
new ViewDataDictionary {{ "Key", obj }}
中的语法。new ViewDataDictionary()
中的括号在哪里? - Mahmood Dehghan@{ var obj = ViewBag.Key; }
也可以用来访问传递的数据。 - MEC