MVC Razor combo box- not getting value

1 posts, 0 answers
  1. simmaneni
    simmaneni avatar
    1 posts
    Member since:
    Mar 2012

    Posted 27 Apr 2013 Link to this post

    Hi,
    I have a combo box in edit mode of a telerik grid, but I am getting null value for selected value on onchange event. Please see code below

    partail view:

     

     

    Html.Telerik().ComboBox().Name("StyleImage").ClientEvents(events => events
    .OnChange("onChange")
     )

    here is js code

    function onChange(e) {
        alert(e.value);
    }

     here is grid onedit

    function Grid_onEdit(e) {
               var styleImage = $('#StyleImage').data('tComboBox');
                $.getJSON(appUrl("Controller/Action"),
                    { styleId: styleValue },
                    function (data) {
                        styleImage.dataBind(data.value);
                        styleImage.value(e.dataItem['DefaultImage']);
                    }
                );
            }
     
        }

     Here is controller code

    public JsonResult Action(string styleId)
           {
              List<string> images=new List<string>();           
              return Json(new { success = true, value = images }, JsonRequestBehavior.AllowGet);
           }

    this is how I am seeing rendered code for combo box
    <div class="t-animation-container" style="width: 150px; height: 214px; position: absolute; z-index: 10002; top: 382.817px; left: 599.733px; display: none;">




    Thanks..
Back to Top