Home > MVC > How To Get ViewBag Value In Javascript



How To Get ViewBag Value In Javascript

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


In this article, we will explain how to get ViewBag value in Javascript with an example and a sample code. In this example, we have created a sample form page, We are using ViewBag for display message in the Javascript on window onload function.

 

Step -1

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

How To Get ViewBag Value In Javascript

 

Step -2

Select new project type.

How To Get ViewBag Value In Javascript

 

Index.cshtml

We have provided html code below.

 

Model

 

StockController

 

Screenshot

How To Get ViewBag Value In Javascript

 




Note: All contents are copyright of their authors.



Comments



Leave a Reply

Comment:*
Email ID:*


Name:*