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. Razor Pages - Persisting a SelectList

Razor Pages - Persisting a SelectList

Scheduled Pinned Locked Moved ASP.NET
asp-netdatabase
3 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.
  • M Offline
    M Offline
    Mycroft Holmes
    wrote on last edited by
    #1

    I am struggling to find the best way to persist a select list collection from the OnGet to the OnPost. This is required because I have a razor page with multiple tabs where the user save the details in the first tab (using OnPost that clears the SelectList) and then continues to the next tabs. Repopulating the collection(s) from the database after the post works but that seems like it is the wrong answer.

    Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

    Richard DeemingR 1 Reply Last reply
    0
    • M Mycroft Holmes

      I am struggling to find the best way to persist a select list collection from the OnGet to the OnPost. This is required because I have a razor page with multiple tabs where the user save the details in the first tab (using OnPost that clears the SelectList) and then continues to the next tabs. Repopulating the collection(s) from the database after the post works but that seems like it is the wrong answer.

      Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Mycroft Holmes wrote:

      Repopulating the collection(s) from the database after the post works but that seems like it is the wrong answer.

      Why does it seem like the wrong answer? The only other options would be to store the entire list in one or more hidden fields, which would bloat the request and response sizes; or to store the list in the session, which would increase the memory pressure on the server. If it's possible to reload the list from the database, that seems like the least-bad option.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      M 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        Mycroft Holmes wrote:

        Repopulating the collection(s) from the database after the post works but that seems like it is the wrong answer.

        Why does it seem like the wrong answer? The only other options would be to store the entire list in one or more hidden fields, which would bloat the request and response sizes; or to store the list in the session, which would increase the memory pressure on the server. If it's possible to reload the list from the database, that seems like the least-bad option.


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        Interesting, as a desktop developer I have always attempted to reduce the number of calls to the database, caching static tables in memory on the local machine. I was looking for a similar capability in the web development arena. I will have no compunction reloading from the database in future, it will reduce some of the gymnastics I used to perform about current lists!

        Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

        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