Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

View is not getting refreshed in Asp.net mvc core 1.1

$
0
0

I am developing an MVC web application using Asp.net core 1.1 . In view i am creating grid by looping the div's.

@foreach (var eachItem in Model.PageProjects)
                {
 <div class="media-body no-right">
                                <div class="media-left">
                                    #@eachItem.ProjectNumber
                                    <h4 class="media-heading"><a href="">@eachItem.ProjectName</a></h4>
                                </div>
                                <div class="media-left">
                                    <h4 class="media-heading"><span class="label label-default">Stage @eachItem.Stage</span></h4>
                                
                                </div>
                                <div class="media-left">
                                                                       
                                        <h4 class="media-heading">@eachItem.PmUsername</h4>
                                   
                                    <span class="text-uppercase">project manager</span>
                                </div>
                              
                                <div class="media-left">
                                    <h4 class="media-heading">@eachItem.LastUpdatedOn</h4>
                                    <span class="text-uppercase">last updated</span>
                                </div>
                            </div>
       }
Based on the dropdown value, i want to sort the grid
  @Html.DropDownList("StageDropDown", new List<SelectListItem>
                                        {
                                            new SelectListItem { Text = "None", Value = "ProjectNumber"},
                                            new SelectListItem { Text = "Project Manager", Value = "ProjectManager" }, 
                                            new SelectListItem { Text = "Last Updated", Value = "LastUpdatedOn" , Selected = true }
                                        }, "Select Stage", new { @class = "form-control" })

I am firing the jquery post event to call the action method

 $("#StageDropDown").on("change", function () {
    
$.post("/Projects/Index", { sortOrder: $('#StageDropDown :selected').val(), CurrentSort: $('#currentStageSortOrder').val() });

    });

The above  event calls action method , I am sorting the list data & it is assigned to the div by using Model, but the view is not getting refreshed, it is showing old values

I have used DistributedMemoryCache & Session, commented both of this & tried again but still the view is not getting refreshed, it is showing old values.

The values is getting sorted in the list but sorted values is not getting reflected when the view is rendered. 

Could you please provide the suggestion ?

Thanks in advance


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>