如何在index.cshtml或任何视图中使用ViewBag [英] How to use ViewBag in index.cshtml or in any view

查看:323
本文介绍了如何在index.cshtml或任何视图中使用ViewBag的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个控制器,说C1,因为我有两个动作a1(Index)和a2(Callmybag),并且每个动作分别具有viewbag v1和v2.我想在Index.chtml(View)中使用这些v1和v2.

我想知道,
1.如何在index.cshtml中使用v2

提供我任何链接

在此先感谢....

Hai all,

I have a controller say C1 and in that i have two actions a1(Index) and a2(Callmybag) and each of them having viewbags v1 and v2 respectively. I want to use these v1 and v2 in Index.chtml(View).

I want to know that,
1.How to use v2 in index.cshtml

Provide me any links

Thanks in advance....

推荐答案

浏览以下链接以了解如何使用ViewBag:
MSDN:使用剃刀语法创建主页视图 [ MSDN:在剃刀视图中使用模型 [何时在ASP.NET MVC 3应用程序中使用ViewBag,ViewData或TempData [
Go through these links to see how ViewBag can be used:
MSDN: Creating a Home Page View Using Razor Syntax[^]
MSDN: Using Models in Razor Views[^]
When to use ViewBag, ViewData, or TempData in ASP.NET MVC 3 applications[^]

Try!


这篇关于如何在index.cshtml或任何视图中使用ViewBag的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆