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

MVC Razor combo box- not getting value

0 Answers 86 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
simmaneni
Top achievements
Rank 1
simmaneni asked on 28 Apr 2013, 04:10 AM
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;">

<div class="t-popup t-group" style="display: block; height: auto; overflow: auto; width: 148px; margin-top: -214px;">
<ul class="t-reset">
<li class="t-item" unselectable="on">GWTUTU2-BRMLL</li>
<li class="t-item" unselectable="on">GWTUTU2-PIMLL</li>
<li class="t-item" unselectable="on">GWTUTU2-SILTX</li>
<li class="t-item t-state-selected" unselectable="on">GWTUTU2-BLMLL</li>
<li class="t-item" unselectable="on">GWTUTU2-YELLL</li>
<li class="t-item" unselectable="on">GWTUTU2-MPILL</li>
<li class="t-item" unselectable="on">GWTUTU2-DPILL</li>
<li class="t-item" unselectable="on">GWTUTU2-BUMLL</li>
<li class="t-item" unselectable="on">GWTUTU2-BLKLL</li>
<li class="t-item" unselectable="on">GWTUTU2-DGRLL</li>
</ul>
</div>
</div>



Thanks..

No answers yet. Maybe you can help?

Tags
ComboBox
Asked by
simmaneni
Top achievements
Rank 1
Share this question
or