从下拉列表jquery中选择一个值后回发

时间:2014-01-27 02:46:14

标签: c# javascript jquery asp.net

从页面中的组合框中选择一个值。它不会在服务器端返回。

<asp:DropDownList ID="dllTest" runat="server" AutoPostBack="true" OnSelectedIndexChanged="dllTest_SelectedIndexChanged">

并将下拉列表设为组合框

$("#<%=dllTest.ClientID%>").combobox();

此外,我想触发ddlTest_SelectedIndexChange。

我尝试执行此操作$('#dllTest').combobox();并将下拉列表的属性添加到ClientIDMode="Static"无效。

我想要的是在从组合框中选择一个值后,selectedindexchange将在后面的代码中触发

1 个答案:

答案 0 :(得分:1)

您需要使用组合框的选择功能,如下所示。因为当你使用组合框时它会隐藏你的下拉列表。

select: function (event, ui) {
                 ui.item.option.selected = true;
                self._trigger("selected", event, {
                     item: ui.item.option
                 }
                 );
                 __doPostBack('<%= dllTest.UniqueID %>', '');
             },
相关问题