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

时间:2012-01-21 09:26:18

标签: javascript commandargument

我想在commandArgument of button中传递选定的下拉文本(ddlTime)。

注意:Dropdown的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”)来捕获参数。 请给我一些提示。

1 个答案:

答案 0 :(得分:0)

很难通过您提供的少量信息了解您的要求。

但是从我的愿景来看,你可以试试这个:

使用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参数。

相关问题