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. MVC3: How to get the text box value as parameter?

MVC3: How to get the text box value as parameter?

Scheduled Pinned Locked Moved ASP.NET
databasequestioncsharphtmllinq
1 Posts 1 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.
  • T Offline
    T Offline
    Tesic Goran
    wrote on last edited by
    #1

    Hi, I'm new in MVC3 and have a simple question. I have Index.cshtml file (view) with 2 controls text box and hyper link: @Html.TextBox("contId") @Html.ActionLink("Query", "Query") In controller class I'd like to have an action that handles clicking hyper link and getting the value of text box above in order to use it in LINQ construction as follows:

    public ActionResult Query()
    {
    // How to get text box value?
    int cid = ... ?

    var data = from continents in db.Continents
               where continents.ContinentID == cid
               select continents;
    
    return View(data);
    

    }

    The result of LINQ query should be displayed on next view. Thank you in advance. Goran

    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