Hi,
I want to pass this varible "diff" from controller to view (Razor)
TimeSpan diff = vacationRttDemand.EndDate - vacationRttDemand.BeginDate;
and after passing , i want do display it ino label or labelfor
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Benmakhlouf SaadPosted Jul 11, 2016, 10:10 AM
Ravi PatelPosted Jul 11, 2016, 9:12 AM
Benmakhlouf SaadPosted Jul 11, 2016, 8:59 AM
Ravi PatelPosted Jul 11, 2016, 8:56 AM
in controller action method
public ActionResult Create()
{
ViewBag.diff = "30" ;
}
in view page
@Html.Label("Set from controller",(string)ViewBag.diff)
try it in above way
but in your case you need some type casting
kalu singh raoPosted Jul 11, 2016, 8:53 AM
Suthish NairPosted Jul 11, 2016, 8:28 AM