0

To send a value from partial view to layout view . i used in partial view as

viewbag.var="Device" 

and retrieve value on layout view by

<h1> @viewbag.var </h1> 

but not showing any values.plaese help .thanks in advance

6
  • Try to use (ViewBag) instead of (viewbag) Commented Aug 10, 2015 at 10:05
  • i tried it but not working Commented Aug 10, 2015 at 10:08
  • The partial uses a separate ViewDataDictionary. The answers here give a few options you could consider Commented Aug 10, 2015 at 11:06
  • @Stephen I need to print the separete heading for each partial view.. how can I implement that? Commented Aug 10, 2015 at 11:29
  • Then why don't you include the heading in the partial? But the link I gave in my last comment has some solutions. Commented Aug 10, 2015 at 11:31

1 Answer 1

0

Try to use TempData: TempData["var"]="Device"

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.