Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Queried result from cotroller to PartialView into Listbox

Queried result from cotroller to PartialView into Listbox

Scheduled Pinned Locked Moved ASP.NET
asp-netcsharpdatabasearchitecturehelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sunsher
    wrote on last edited by
    #1

    Hi, I am new to ASP.NET MVC. I would like to get some help on getting custom data from controller to view. I have queried and concatenated the result of a table from model based on a criteria. I want this to be viewed as a partial view in the Index page. For this, I pass the queried result as follows [CODE]return PartialView(rds.ToList())[/CODE] The purpose is to display a listview of these items in the Index view as partial. I don't know how to grab this data from the partial view. Please help. Thanks

    F 1 Reply Last reply
    0
    • S sunsher

      Hi, I am new to ASP.NET MVC. I would like to get some help on getting custom data from controller to view. I have queried and concatenated the result of a table from model based on a criteria. I want this to be viewed as a partial view in the Index page. For this, I pass the queried result as follows [CODE]return PartialView(rds.ToList())[/CODE] The purpose is to display a listview of these items in the Index view as partial. I don't know how to grab this data from the partial view. Please help. Thanks

      F Offline
      F Offline
      F ES Sitecore
      wrote on last edited by
      #2

      Just give your partial view a @model of whatever type "tds.ToList()" is

      @model List

      or whatever it happens to be, then in your view

      foreach (var item in Model)
      {

      @item.SomeProperty

      }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups