1

在我看来,我有一个 devexpress combobx:

Html.DevExpress().ComboBox(s =>
                                       {
                                           s.Name = idPola;
                                           s.Style.Add("float", "left");
                                           foreach (SelectListItem item in list)
                                           {
                                               s.Properties.Items.Add(new ListEditItem()
                                               {
                                                   Text = item.Text,
                                                   Value = item.Value,
                                                   Selected = item.Value == selectedValue
                                               });
                                           }
                                           s.SelectedIndex = selectedIndex;
                                           s.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
                                           s.ClientVisible = ControlVisible;
                                           if (Model.Alternative)
                                           {
                                               s.Properties.ClientSideEvents.SelectedIndexChanged =  "function(s, e){ffff(s)}";
                                           }
                                           else
                                           {
                                               s.Properties.ClientSideEvents.SelectedIndexChanged = "function(s, e){HideTextBox(s,e)}";
                                           }
                                           s.Properties.EnableClientSideAPI = true;
                                       }).Render();

如何在 HideTextBox 函数中使用 javascript 获取所选项目的 id?

4

1 回答 1

3

使用客户端 GetValue 方法:

function HideTextBox(s, e) {
    //s == ComboBox
    var value = s.GetValue();
    alert(value);
}
于 2013-07-15T20:41:12.807 回答