Getting Object doesn't support this action error

2 posts, 0 answers
  1. Paul
    Paul avatar
    32 posts
    Member since:
    Mar 2011

    Posted 05 Nov 2012 Link to this post

    First I'll post the code.
    Here's the javascript code:

         function sortByStatus() {
     
    //             var item = eventArgs.get_item();
                 //             var strSort = item.get_value();
                 var combo = $find("<%= rcbStatus.ClientID %>");
                 var comboItem = combo.get_selectedItem();
                 var strSort = comboItem.get_value();
                 alert('Selected ' + comboItem.get_value());
     
                 if (strSort != 'Active') {
                     window.location = 'meet-the-panel.aspx?paneltype=' + strSort;
                 } else {
                     window.location = 'meet-the-panel.aspx';
                 }
                 
         }


    <telerik:RadComboBox ID="rcbStatus" runat="server" Skin="Black" EnableEmbeddedSkins="false" Width="220px" >
                    <Items>
                        <telerik:RadComboBoxItem Value="Active" Text="Current Panelists"/>
                        <telerik:RadComboBoxItem Value="alumni" Text="Past Panelists"/>                   
                    </Items>
    </telerik:RadComboBox>

    What this is supposed to do is that when an element is selected run the javascript and go to that page. It works for a few times and then my browser errors with this 'SCRIPT445: Object doesn't support this action' and highlights this line: var a=g?new h(g):new h. At first I thought that the function was not mapping to the combobox and setting the onclientselectedindexchanged on the server side and that did nothing.  I tried setting the autopostback to true and tried it from serverside but I instantly got the same error after one selection. Then I thought that it's not grabbing the value from the box, but from the alert it looked like it was working. The only thing left was the windows.location so I commented that out and I don't receive that error anymore. Something is happening with the redirections that is causing this and I have no idea what it could be. I dont know if this helps but we are using custom skins for this combobox.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 Nov 2012 Link to this post

    Hi Paul,

    Unfortunately I couldn't replicate the issue you are facing. One suggestion is that you can redirect the window using linkbutton as follows.

    ASPX:
    <asp:LinkButton ID="LinkButton1" runat="server" Text=""></asp:LinkButton>

    JS:
    <script type="text/javascript">
    function sortByStatus()
    {
      var combo = $find("<%= rcbStatus.ClientID %>");
      var comboItem = combo.get_selectedItem();
      var strSort = comboItem.get_value();
      alert('Selected ' + comboItem.get_value());
      var btn = document.getElementById("LinkButton1");
      if (strSort != 'Active')
      {
       btn.href = 'EmptyMessage.aspx?paneltype=' + strSort;
      }
      else
      {
       btn.href = 'EmptyMessage.aspx';
      }
      btn.click();
    }
    </script>

    Hope this helps.

    Thanks,
    Princy.
Back to Top