Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Passing values from controller to view and back

Avatar of Bardobrave
BardobraveFlag for Spain asked on
.NET ProgrammingC#ASP.NETWeb Frameworks
10 Comments1 Solution1359 ViewsLast Modified:
Hi experts.

I'm developing a web app through ASP.NET MVC.

I have several listings that calls controller methods over business elements to edit or erase them. Usually, when an element is erased, controller returns execution to the list (so
users can see their erased element is out of the list).

And here comes the question. I have several different listings that can show the same business elements (I mean, there are lists that filter in different ways or show different data of
same business elements) and I want to make controller know where to return when an element is erased (so if I call it from a determinated list I want the eraser controller to come back
to it when finished).

So I'm thinking in the best approach for this. I'd like to use some sort of "session variable" to store at any moment the last listing executed, this way any controller could determine when it has to call a listing wich one must be called.

However I'm not very used yet to work in ASP.NET MVC and the only way I'm seeing is to adding a new parameter to controller methods with this "last listing" value, passing it to views through ViewData and back to controllers into the forms or links that
calls them.

However I'm sure it should be an easier way.
Any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of static-void
static-void

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answers