asp.net mvc language

http://stackoverflow.com/questions/8310778/mvc-validation-same-project-different-languages-why

http://haacked.com/archive/2010/05/10/globalizing-mvc-validation.aspx

http://haacked.com/archive/2009/12/12/localizing-aspnetmvc-validation.aspx


jqueyr  easy ui  http://www.iteye.com/topic/1081739

 

 

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

 

The *right* JSON content type?

 

The MIME media type for JSON text is application/json.

 

 

 

 public class HomeController : Controller
    {

        private List<Category> GetOptions()
        {
            List<Category> categories = new List<Category>();
            categories.Add(new Category() { ID = 2, Name = "Bikes" });
            categories.Add(new Category() { ID = 1, Name = "Cars" });
            categories.Add(new Category() { ID = 3, Name = "Trucks" });
            return categories;
        }
       
        public ActionResult Index()
        {
            Product product = new Product();
            ViewBag.Categories = GetOptions();
            return View(product);
        }

        [HttpPost]
        public ActionResult Index(Product product)
        {
            ViewBag.Categories = GetOptions();
            return View(product);
        }

        public ActionResult About()
        {
            return View();
        }

 

 

 

 

 

 

 

 


<h2>@ViewBag.Message</h2>
   <div>
 
@Html.DisplayForModel()
 
<h1>Change Values</h1>
@using (Html.BeginForm())
   {     
     @Html.DropDownListFor(x => x.CategoryID, new SelectList(ViewBag.Categories, "ID", "Name", Model.CategoryID))    
   <input type="submit" value="Submit" />
}
    </div>


@Html.DropDownList("day",
    new  SelectList(    
        new Dictionary<int,string> {
            {  1 , "Weekly" },
            {  2 ,  "Monthly" },
            {  3 ,  "Quarterly" },
            {  4 ,  "Annually" } },
                "Key", "Value",3))

 

 

http://stackoverflow.com/questions/624828/asp-net-mvc-html-dropdownlist-selectedvalue

 

 public  class Category
    {
        public int ID { get; set; }
            public string Name {get;set;}
    }

  private List<Category> GetOptions()
        {
            List<Category> categories = new List<Category>();
            categories.Add(new Category() { ID = 2, Name = "Bikes" });
            categories.Add(new Category() { ID = 1, Name = "Cars" });
            categories.Add(new Category() { ID = 3, Name = "Trucks" });
            return categories;
        }

        public ActionResult Index()
        {
            ViewBag.Message = "Welcome to ASP.NET MVC!";
            var query = GetOptions();
            return View(query);
        }

        public ActionResult Edit(int id)
        {
            var list = GetOptions();
            var selectList = new SelectList(list, "ID", "Name", id);
            ViewData["options"] = selectList;

            ViewBag.options = selectList;
         
            var query = GetOptions().Where(o=>o.ID==id).FirstOrDefault();
            return View(query);
        }

 

          @Html.DropDownList("ID", (SelectList)ViewBag.options)

 

 

http://stackoverflow.com/questions/624828/asp-net-mvc-html-dropdownlist-selectedvalue

 

http://stackoverflow.com/questions/3627894/asp-net-mvc-dropdownlist-and-selected-value

posted @ 2012-09-07 10:02  rayray2  阅读(257)  评论(0编辑  收藏  举报