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

Trouble with DropDownList

0 Answers 47 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
AspenSquare
Top achievements
Rank 1
AspenSquare asked on 03 Jul 2012, 06:30 PM
I'm having issues Databinding to my DropDownList. My Grid is working fine. My DropDownList on the otherhand, 
I would like to populate with AmenityTypes.

[AmenityController]
[HttpPost]
        public ActionResult _AjaxBinding(string text)
        {
            Mvc.Models.AmenityType.AmenityTypeModel _amenityTypes = new Models.AmenityType.AmenityTypeModel();
            _amenityTypes.AmenityTypesList = Mvc.Models.AmenityType.Repository.AmenityTypeMethods.GetAmenityTypes();
 
            return new JsonResult { Data = new SelectList(_amenityTypes.AmenityTypesList) };
        }





[View]
<
div class="fl">
        @(Html.Telerik().DropDownList()
            .DataBinding(dataBinding => dataBinding
                .Ajax()
                    .Select("_AjaxBinding", "Amenity"))
 </div>
     
     
     
    <div class="clr pt5">
        <!-- list -->
        @(Html.Telerik().Grid(Model.AmenityList)
            .DataKeys(k => k.Add(o => o.AmenityID))
            .DataBinding(dataBinding => dataBinding
                .Ajax()
                    .Select("Index", "Home")
                    //.Insert("Insert", "Grid")
                    //.Update("Update", "Grid")
                    //.Delete("DeleteAmenity", "PropertyAmenitListGrid"))
                    .Delete("DeleteAmenity", "Amenity"))
            .Name("PropertyAmenitListGrid")
            .Scrollable()
            .Pageable()
            .Selectable()
            .Columns(col =>
            {
                col.Bound(c => c.Name);
                col.Command(commands =>
                {
                    commands.Delete();
                }).Width(100);
            })
        )
        @Html.HiddenFor(x => x.PropertyID)
    </div>
Tags
ComboBox
Asked by
AspenSquare
Top achievements
Rank 1
Share this question
or