6
Answers

My ViewBag.JobNo is not working in MVC

Deepak

Deepak

8y
937
1

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)