Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all...
I am new in mvc and i'm stuck with a problem.
I do have a parent view(for class A) in which on html.action creating a pop up(pop up is using partial view for class B).
Now when pop up is popped from that i want to select an object from that view and want to show that's value in a text box of parent view. If i use html.action, it can only pass key/value pair not complex data types.
What should i do in this case?
Posted
Updated 18-Dec-16 19:04pm

you can store value of object in Viewbag or ViewData and store that value in your parent textbox.
 
Share this answer
 
Hi,

You can achieve it many ways.

First, you can use model or viewmodel.

Second, use ViewBag or TempData. If you are traversing from one request to other request than better to use TempData otherwise ViewBag is just fine.
 
Share this answer
 
you can use view bag , view data in case of view- to - controller and wn you pass data controller - controller by temp data.
C#
Just like ViewData, typecasting and null checks required for TempData also in order to avoid errors.
 
Share this answer
 
You can take help with model class and by using strongly typed view U can share Complex Data to view.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900