2012-01-21 24 views
0

我想在commandArgument按鈕中傳遞選定的下拉文本(ddlTime)。在相同的aspx頁面上的commandArgument中傳遞選定的下拉文本?

注意: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" /> 

我HV寫了一個JS功能( 「OnClientClicked_ViewAssignedCust」)來捕捉參數。 請給我一些提示。

回答

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參數可以在服務器代碼檢索只。

+0

我們可以在javascript函數中檢索命令參數。我已經用代碼測試過了。我只想在命令參數中傳遞選定的下拉文本。 – Abhi

+0

你可以直接在你的JS函數中獲得下拉列表中的選定文本。 $(「#ddlTimeClientID option:selected」)。text(); –

相關問題