Home I am not able to transfer data from viewbag to partial view?
Reply: 0

I am not able to transfer data from viewbag to partial view?

Shiva
1#
Shiva Published in 2018-02-14 06:41:32Z

I am passing a success message to the view bag and try to get it in partial view.

controller code:
 [HttpPost]
    [ActionName("EmployeeUpdate")]
    public IActionResult UpdatePhoneNumber_Post(string userId, string phone)
    {
        //phone = (string)TempData["Phone"];
        userId = HttpContext.Session.GetString("UserID");
        // ViewBag.Phone = phone;
        _context.UpdPhoneNumber("updPhoneNumber", userId, phone);
        ViewBag.Message = "Success";
        return PartialView("_PhoneNumberUpdate", ViewBag.Message);
    }

And i am trying to access in partial view

<span style="color:yellow">@ViewBag.Message</span>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.318253 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO