Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have session with 10 records
That i have to use and display records in view based on where condition.

Session Data:
HttpContext.Current.Session["CompleteData"] = objCustomer.GetAccountList();

In controller how can i manage that session to display in view
I am trying to the below code bot not able to display in view.

XML
public ActionResult SampleBook3()
        {

            var list = Session["CompleteData"] as List<Book>;
            list = list.Where(x => x.ID == 4).ToList();
            return View(list);


        }
Posted

first debug and check whether list object has the data and if not then , share you view code , like how you are putting it, would be really helpful.
 
Share this answer
 
Hi
for display session data in mvc4.
like suppose you have employee model and in session you store the data of session and want to display it.
so directly you can store session in variable like

var EMP= (EmployeeModel)Session[Empdata];


and then after display this list
i hope its help to you
Thanks
Uttam
 
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