ASP MVC ViewData from one view to another (Html.Encode())

Posted by Jacob Huggart on Stack Overflow See other posts from Stack Overflow or by Jacob Huggart
Published on 2010-05-24T19:07:06Z Indexed on 2010/05/24 19:11 UTC
Read the original article Hit count: 183

Filed under:
|

Hello all,

I have a page with a bunch of labels and checkboxes on it. On this page, the labels need to be easily customizable after the project is deployed.

So I made all of the labels in this style:

Html.Encode(ViewData["lblText"])

And I added a button on the page called "Edit Button Labels" that will only be seen by admins.

When that button is clicked, I would like to load another view that simply contains a table of two columns. One column needs to contain the current labels and the other should have text boxes for the user to enter new labels.

Then, once any changes have been made, I need to permanently change the "lblText" for each label on the original page.

I have tried passing viewdata and tempdata to the "Edit Button Labels" view using both return view() and return RedirectToAction() with no success. Am I missing something minor or is there a better way to do this?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about viewdata