Home > ASP.NET > How to get ViewBag value in View from Controller



How to get ViewBag value in View from Controller

In this article, we will explain how to get ViewBag value in View from Controller with an example and sample code.


In this article, we will explain how to get ViewBag value in View from Controller with an example and sample code. In this example, we have created a sample form page, We are using ViewBag to display Message in the View after button click.

 

Step -1

Open Visual Studio. Click on the file in the menu and select new Project .

How to get ViewBag value in View from Controller

 

Step -2

Select new project type.

How to get ViewBag value in View from Controller

 

Index.cshtml

We have provided html code below.

 

Model

 

StockController

 

Screenshot

How to get ViewBag value in View from Controller

 




Note: All contents are copyright of their authors.



Comments



Leave a Reply

Comment:*
Email ID:*


Name:*