Total Page Preview: 000000000732
What is Viewbag in Asp.Net Core MVC in English and Hindi
Viewbag in Asp.Net Core MVC in English
In ASP.NET Core MVC, a ViewBag is a dynamic property that allows you to share data between a controller action method and its corresponding view. It's a way to pass small amounts of data from the controller to the view without the need to create a dedicated strongly-typed model or using ViewData.
Here's how the ViewBag works:
Controller Action:
In your controller action method, you can assign values to the ViewBag properties. For example:
View:
In your corresponding Razor view, you can access the values stored in the ViewBag like this:
Viewbag in Asp.Net Core MVC in Hindi
ASP.NET Core MVC mein, ViewBag ek dynamic property hai jo controller action method aur uske corresponding view ke beech mein data share karne ki anumati deta hai. Ye ek tareeka hai controller se view tak chhote se amounts of data ko bhejne ka, bina dedicated strongly-typed model banane ya ViewData ka istemal karne ke.
Thank You
About Author
Brijesh Kumar
Database Developer
I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL
Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall
and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com