How to change and get value from a dropdownlist in a RadGrid column?

2 posts, 0 answers
  1. DanYeung
    DanYeung avatar
    1 posts
    Member since:
    Jul 2016

    Posted 08 Jul 2016 Link to this post

    I am using a RadGrid and have some controls in columns. A DropDownList  is in ItemTemplate (see code below). For example, when the grid was first bind with a dataset, "HI" was selected. I changed the selection to "AZ" and click another control in another column to call the Javascript function "showCityList" (see code below). Then I use Google F12 to step into the function. I have two questions.

    1. I can see the var cell that has all states in the dropdownlist and "HI" is selected. <option selected="selected" value="HI">HI</option>. I changed the selection to "AZ". Why the initial state was still be selected?

    2. How do I get the selected state? Please provide the syntax. 

    I CANNOT use OnSelectedIndexChanged and it is a long story to explain.  

    <telerik:GridTemplateColumn HeaderText=" State" SortExpression="State_Code" UniqueName="State_Code">
        <asp:DropDownList ID="cboState" Width="105px" CssClass="State_Code" runat="server" ></asp:DropDownList>


    function showCityList() {
                    var row = Telerik.Web.UI.Grid.GetFirstParentByTagName(button, "tr");
                    var rowIndex ="__")[1];
                    var MasterTable = $find("<%=gridSites.ClientID%>").get_masterTableView();
                    var selectedRows = MasterTable.get_dataItems();
                    if (selectedRows != null)
                        var row = selectedRows[rowIndex];
                        var cell = MasterTable.getCellByColumnUniqueName(row, "State_Code")
                 return false;



  2. Eyup
    Eyup avatar
    3320 posts

    Posted 13 Jul 2016 Link to this post

    Hello DanYeung,

    Generally, you can use the $telerik.findControl or findElement methods. You can examine the web site sample provided in the following post for a similar implementation:

    If you are using using EditForms or PopUp mode, the correct way to get the container edit form is using the following method:
    Copy Code
    Copy Code
    for (var i = 0; i < editItems.length; i++) {
    function selectedIndexChanged(sender, args, index, tableViewID) {
        var tableView = $find(tableViewID);
        var editForm = index >= 0 ? tableView.get_dataItems()[index].get_editFormItem() : tableView.get_insertItem();

    I hope this will prove helpful.

    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top