我认为我有一个devexpress组合框:
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();
如何在隐藏文本框功能中使用javascript获取所选项目的ID?
答案 0 :(得分:3)
使用客户端GetValue方法:
function HideTextBox(s, e) {
//s == ComboBox
var value = s.GetValue();
alert(value);
}