This is a migrated thread and some comments may be shown as answers.

DropDownListFor to model dont work

1 Answer 157 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Vlad
Top achievements
Rank 1
Vlad asked on 10 Apr 2014, 12:55 PM
  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?





1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 10 Apr 2014, 02:18 PM
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.

 
Tags
DropDownList
Asked by
Vlad
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or