6
Reply

My ViewBag.JobNo is not working in MVC

Deepak

Deepak

Dec 29 2016 11:04 AM
433

I am using ViewBag.JobNo and it is not working. I am using ViewBag.JobNo in my controller as:

ViewBag.JobNo = "test";

In my View, I am using it as:

@Html.TextBox("txtJobNo", (string)ViewBag.JobNo , new { @class = "col-md-10 form-control" })

I am getting my TextBox empty.

But when I am using ViewBag.Title in place of ViewBag.JobNo, it is working fine.

Please help me, if you have some idea. Thanks..


Answers (6)