DropDownListFor to model dont work

2 posts, 0 answers
  1. Vlad
    Vlad avatar
    1 posts
    Member since:
    Mar 2014

    Posted 10 Apr 2014 Link to this post

      model
    public class OModel
    {
    public IEnumerable<REF_OTRASLEVAYA_PRENADLEGNOST> RefOtraslevayaPrenadlegnost { get;set; }
    public int OTRASL_ID { get; set; }
    }

    html
    @model OModel
    @Html.Kendo().DropDownListFor(m => m.OTRASL_ID).Name("Otraslevaya").DataTextField("Text").DataValueField("Value").BindTo(Model.RefOtraslevayaPrenadlegnost)

    control
    public ActionResult Update()
            {    
                return View(new OModel{RefOtraslevayaPrenadlegnost=dataManager.RefOtraslevayaPrenadlegnosts.GetRefOtraslevayaPrenadlegnosts());
            }


    [HttpPost]
            public ActionResult Update(Model model)
            {
                      int i = model.OTRASL_ID   //  =0  ?????????????
                return View(model);
            }


    when I select a value in DropDoschnListFor nazhimatyu and submit, then the selected value does not come to the server. Why?





  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 10 Apr 2014 Link to this post

    Hello Vlad,

    I would suggest you check the "Telerik UI for ASP.NET MVC Fundamentals" help topic to understand what is the difference between strongly-typed and non-strongly-typed extensions. Also a solution to the described issue can be found in this troubleshooting section.

    Regards,
    Georgi Krustev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top