我想在按钮的commandArgument中传递选定的下拉文本(ddlTime)。
注意:下拉菜单的 Autopostback = false。
代码- ASPX-
<asp:DropDownList ID="ddlTime" runat="server" AutoPostBack="false" Width="70">
</asp:DropDownList>
<telerik:RadButton ID="btnViewSun" runat="server" Text="View" CommandArgument="-pass selected value here-"
OnClientClicked="OnClientClicked_ViewAssignedCust" ButtonType="LinkButton" BorderStyle="None" />
我编写了一个 JS 函数(“OnClientClicked_ViewAssignedCust”)来捕获参数。 请给我一些提示。
最佳答案
仅凭您提供的少量信息很难了解您的需求。
但从我的 Angular 来看,你可以尝试这个:
使用 JQuery 获取 javascript 事件中选定的值,如下所示:
$("#<%=ddlTime.ClientID%>").val();
or if you know the clientid of the dropdown use this:
$("#ddlTimeClientID").val(); //subs. ddlTimeClientID by the ddlTime controls client ID
CommandArgument 参数只能在服务器代码中检索。
关于javascript - 在同一 aspx 页面上的 commandArgument 中传递选定的下拉文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8951944/