Search Results

Search found 1 results on 1 pages for 'lillie'.

Page 1/1 | 1 

  • ASP.NET MVC: How to show value in a label from selected Drop Down List item?

    - by Lillie
    Hi! I'm trying to show a value of selected Drop Down List item in a label. I managed to make this work with Web Forms but with MVC I'm totally lost. My Index looks like this: [...] <% using (Html.BeginForm()) { %> <table> <tr> <td>Processor</td> <td><%= Html.DropDownList("lstProcessor1", new SelectList((IEnumerable)ViewData["Processor1List"], "product_price", "product_description")) %></td> </tr> <tr> <td>Total Amount</td> <td>0,00 €</td> </tr> </table> <input type="submit" value="Submit" /> <% } %> [...] And my HomeController starts with: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Mvc.Ajax; using MvcApplication1.Models; namespace MvcApplication1.Controllers { [HandleError] public class HomeController : Controller { // Connect database DB50DataContext _ctx = new DB50DataContext(); // GET: /Home/ public ActionResult Index() { // Search: Processors var products = from prod in _ctx.products where prod.product_searchcode == "processor1" select prod; ViewData["Processort1List"] = products; return View(); } I would like the product_price to show on the second line of the table, where it now says 0,00 €. It should also update the price automatically when the item from the Drop Down List is changed. I guess I should use JQuery but I have no idea how. Could someone please give me some tips how to do this?

    Read the article

1