Nothing
Nothing

Reputation: 2642

Display ViewData in View from Controller of asp.net mvc

I have one action in my controller :

public ActionResult ProductSpec()
{
  var pvc = new CMS()
  {
    //blah blah blah
  };
  var count_item = DataContext.GetItemReferences();
  ViewData["ttttt"] = count_item; //8
  return View(pvc);
}

And then I display the ViewData["ttttt"] in my view, but the result is System.Collections.Generic.List1[EWeb.Models.Pro] .

Could anyone tell me how to sovle it please.

Upvotes: 0

Views: 322

Answers (1)

Igor
Igor

Reputation: 15893

Try:

var count_item = DataContext.GetItemReferences().Count;

Upvotes: 1

Related Questions