javascript - 在同一 aspx 页面上的 commandArgument 中传递选定的下拉文本?

标签 javascript commandargument

我想在按钮的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/

相关文章:

asp.net - 如何通过命令按钮发送多个命令参数?(RowCommand 事件)

c# - 在 Repeater 内的 Lightbox 内查找 RadioButton 的选定值

javascript - 没有空格的电子邮件的正则表达式

javascript - 如果 redux 更新了嵌套组件,但 PureComponent 作为 prop 传递给了它的父组件,那么 PureComponent 会重新渲染吗?

javascript - meteor JS : Inconsistency with Meteor JS when dealing with cursors?

javascript - 将 javascript 值传递给链接按钮的 CommandArgument

c - 在 Visual Studio 中使用 "Command Arguments"进行调试不起作用

asp.net - 通过Asp.net中的Button的CommandArgument传递多个参数

javascript - Ajax 调用 Web 服务 - 方法成功但禁止数据访问

javascript - create-react-app 显示错误 "You need to enable JavaScript to run this app."