pass selected dropdown text in commandArgument on same aspx page?

1.1k views Asked by At

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.

1

There are 1 answers

2
Sunil Raj On

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.