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

5 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
    3824 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.
  3. Kiran
    Kiran  avatar
    40 posts
    Member since:
    Oct 2018

    Posted 24 Apr in reply to Eyup Link to this post

    Can you please provide sample code for this?

    I have a radcombobox inside itemtemplate of gridtemplatecolumn of a radgrid. On slectedindexchanged event I want to update record by grabbing few values from other columns of the same record. 


    Thank you.

  4. Kiran
    Kiran  avatar
    40 posts
    Member since:
    Oct 2018

    Posted 24 Apr Link to this post

    I figured this out. If anyone is trying to access radgrid other column values in radcombobox selectedindexchanged via radcombox within radgrid in the item template, see the following:


    Protected Sub radLocID_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs)

            Dim cmbLocId As RadComboBox = CType(sender, RadComboBox)
            Dim item As GridDataItem = CType(cmbLocId.NamingContainer, GridDataItem)
            Dim strLocID As String = (TryCast(sender, RadComboBox)).SelectedValue

            Dim strSYSID As String = item.GetDataKeyValue("IB_MAIN_ID").ToString

        End Sub



    strLocID is the value that comes from radcombox within the radgrid but I also want the value of IB_MAIN_ID which is in another column. 

  5. Eyup
    Eyup avatar
    3824 posts

    Posted 29 Apr Link to this post

    Hi Kiran,

    Thank you for sharing your specific approach with our community. I hope it will prove to other developers as well.

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top