Combobox in RadGrid (Open RadWindow through Javascript)

2 posts, 0 answers
  1. Prasanth100
    Prasanth100 avatar
    17 posts
    Member since:
    Oct 2012

    Posted 06 Apr 2013 Link to this post

    Hello Experts,

      I have added ComboBox in RadGrid, In ComboBox i have options : eg: 1)Cutomers 2)Managers etc.
     If i have select Customers,Rad window should open with customer items and so.
    I want to call javascript dynamically and below is the exact post :

    (But it is working with hyperlink, when i used with RadCombo box it is not working)

    Code In RadGrid ->

    <telerik:GridTemplateColumn UniqueName="TemplateEditColumn">
                             <telerik:RadComboBox ID="RadComboBox2" runat="server" AutoPostBack="true" OnClientSelectedIndexChanged="SelectedIndexChanged" OnSelectedIndexChanged="RadComboBox2_SelectedIndexChanged">
                                    <telerik:RadComboBoxItem />
                                    <telerik:RadComboBoxItem Text="Customers" Value="1" />
                                    <telerik:RadComboBoxItem Text="Managers" Value="2" />
                            </telerik:RadComboBox>  <%--OnClientSelectedIndexChanged="SelectedIndexChanged"--%>

    Code Behind:
                    RadComboBox RadComboBox2 = (RadComboBox)e.Item.FindControl("RadComboBox2");
                    RadComboBox2.Attributes["onclick"] = String.Format("return SelectedIndexChanged('{0}','{1}','{2}','{3}');",sender,e, row.Id, e.Item.ItemIndex);

    <script type="text/javascript">
                function SelectedIndexChanged(sender, eventArgs, id, RowIndex) {
                    var item = eventArgs.get_item();
                    var txt = $get(sender.get_id());
                    txt.value = item.get_value();
                    txt.text = item.get_text();
                    if (txt.text == "NewText4") {
                        if (confirm('Are you sure')) {
                            var grid = $find("<%= RadGrid1.ClientID %>");

                            var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                            grid.get_masterTableView().selectItem(rowControl, true);

                            window.radopen("EditUserDetail.aspx?UserID=" + id, "UserListDialog");
                        else {



               Here the RadWindow is not opening. Please Help with this, 

    Thanks in Advance.
  2. Boyan Dimitrov
    Boyan Dimitrov avatar
    2062 posts

    Posted 10 Apr 2013 Link to this post


    It seems that the problem is related to adding the "onclick" attribute for the RadComboBox and specifically sending the following parameters sender and eventArgs from the code behind.
    In order to avoid that unusual behavior I would suggest storing row.Id and e.Item.ItemIndex values to hidden fields and accessing those hidden field values on the client-side in the function SelectedIndexChanged.

    Kind regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top