Tuesday 9 May 2017

Example of retrieve the data from Arraylist in Controllar to view in asp.net MVC

Follow the Step :


1. Controller Code

        public ActionResult ArrayValue()
        {
            string names = "";
            string[] arr = new string[3] { "Deepak", "Roshan", "mahesh" };
           var quer = from string name in arr select name;
           foreach (var na in quer)
           {
               names = names + " " + na;
           }
           ViewBag.aa = names;
            return View();
        }

2. View Code

  @model ramkola_bhagwat.Models.niitEntities

@{
    ViewBag.Title = "ArrayValue";
}

<h2>ArrayValue</h2>

<p>@ViewBag.aa</p>



Output :



No comments:

Post a Comment