1

I want to pass selected dropdown text (ddlTime) in commandArgument of button.

Note: Dropdown's Autopostback = false.

Code- 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" />

I hv wrote a JS function ("OnClientClicked_ViewAssignedCust") to catch arguments. Please give me some hint.

Abhi
  • 1,963
  • 7
  • 27
  • 33

1 Answers1

0

It is hard to know your requirement with the small amount of information you have given.

But from my vision, you can try this:

Use JQuery to get the selected value in the javascript event like below:

$("#<%=ddlTime.ClientID%>").val();
or if you know the clientid of the dropdown use this:
$("#ddlTimeClientID").val(); //subs. ddlTimeClientID by the ddlTime controls client ID

The CommandArgument parameter can be retrieved in the server code only.

Sunil Raj
  • 460
  • 5
  • 20
  • we can retrieve command args in javascript function. I have tested that with code. I just want to pass selected Dropdown text in command argument. – Abhi Jan 21 '12 at 09:52
  • you can get the selected text of the drop down directly in your JS function. $("#ddlTimeClientID option:selected").text(); – Sunil Raj Jan 21 '12 at 09:58