Click here to Skip to main content
15,169,285 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HI, can any one know how to set ViewBag property in javascript? I am using this code

C#
@{
    ViewBag.Pid = @:Pid
}


where @:Pid is javascript variable and have value in it, but the code is not working and giving syntax error.
Posted
Updated 20-Jun-21 4:59am
v2

   
Comments
Faisalabadians 22-May-13 2:38am
   
Thank you sandeep but I am not talking about javascript variable assignment, I am talking about ViewBag property assignment in javascript
View bag is not intended for this use DTO models.
   
Comments
CHill60 21-Jun-21 12:00pm
   
More or less what Solution 2 said 8 years ago

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900