Click here to Skip to main content
14,978,609 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created one small demo with Tree View in MVC.
On Click of Node of a tree view details of the selected Note will show in Partial view.

In Current stage I have manage to achieve this.
but issue is that When I Click on 2nd page then Tree view is getting filled again which I don't want filled again and again.
I Just want to show tree view with selected values(old values).

Layout.cshtml

<html lang="en">
<head>
<title> Tree view Demo </title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryui")
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/jqueryval1")

</head>
<body>


@*


@RenderBody()



</body>
</html>


TestView in Home Controller

public ActionResult TestView(string players, int? Page_No)
{
if (Session["Sessionplayers"] == null)
{
Session["Sessionplayers"] = players;
}
ViewBag.id = players;
HttpCookie hc = new HttpCookie("test", "1223");
Request.Cookies.Add(hc);
HttpCookie hc1 = new HttpCookie("courseName", Session["Sessionplayers"].ToString());
Request.Cookies.Add(hc1);


PlayerBusinessLayer playerBusinessLayer = new PlayerBusinessLayer();
List<SelectedPlayers> ObjselectedPlayers = playerBusinessLayer.GetAllPlayers(Session["Sessionplayers"].ToString()).ToList();

int Size_Of_Page = 4;
int No_Of_Page = (Page_No ?? 1);
ViewBag.PageCount = No_Of_Page;

//return PartialView("TestView", ObjselectedPlayers.ToPagedList(No_Of_Page,Size_Of_Page));
return View("TestView", ObjselectedPlayers.ToPagedList(No_Of_Page, Size_Of_Page));
}

TestView.cshtml

@*@model IEnumerable<businesslayer.selectedplayers>*@
@model PagedList.IPagedList<businesslayer.selectedplayers>
@using PagedList.Mvc;

@{
Layout = "~/Views/Shared/_LayoutNew.cshtml";
}


@foreach (var item in Model)
{
}
@Html.DisplayName("Select")
Surname
Initials
BatSkill
BowlPos
FieldType
@Html.CheckBox("ABCD")
@Html.DisplayFor(modelItem => item.Surname)
@Html.DisplayFor(modelItem => item.Initials)
@Html.DisplayFor(modelItem => item.BatSkill)
@Html.DisplayFor(modelItem => item.BowlPos)
@Html.DisplayFor(modelItem => item.FieldType)



<input type="button" value="Edit" />


Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
@Html.PagedListPager(Model, Page_No => Url.Action("TestView", new { Page_No, Sorting_Order = ViewBag.CurrentSortOrder, Filter_Value = ViewBag.FilterValue }))
Posted
Updated 17-Nov-15 0:05am
v3
Comments
Suvendu Shekhar Giri 17-Nov-15 14:36pm
   
Format the question correctly first.

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