Script error on RadListboxItem contextmenu showing

4 posts, 0 answers
  1. Nagarajan
    Nagarajan avatar
    7 posts
    Member since:
    Aug 2010

    Posted 09 Nov 2012 Link to this post

    Hi,

    I have RadListboxitems with context menu, after i selected one listboxitem now trying to invoke context menu for another item throws script error says "Microsoft JScript runtime error: 'this._dragSelector' is null or not an object".  Am I missing any properties?

    Listbox
    -----------------
    <telerik:RadListBox runat="server" Skin="Office2010Blue" EnableDragAndDrop="false" ClientIDMode="Static" ID="Listbox"
                            DataTextField="category" DataValueField="categoryid" OnClientContextMenu="showContextMenu" 
                            AllowAutomaticUpdates="false" AllowDelete="false" AllowReorder="false" AllowTransfer="false" SelectionMode="Single"
                                Width="200px" Height="350px" OnClientSelectedIndexChanged = "Listbox_OnClientSelectedIndexChanged">
    </telerik:RadListBox>

    Contextmenu
    ------------------------
    <telerik:RadContextMenu ID="Contextmenu" runat="server" Skin="Office2010Blue">
                           <Items>
                               <telerik:RadMenuItem Text="Add"></telerik:RadMenuItem>
                               <telerik:RadMenuItem Text="Edit "></telerik:RadMenuItem>
                               <telerik:RadMenuItem Text="Delete"></telerik:RadMenuItem>
                           </Items>
     </telerik:RadContextMenu>


    Thanks,
    Nagarajan.
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 13 Nov 2012 Link to this post

    Hello Nagarajan,

    Can you please provide the code used for the OnClientContextMenu and OnClientSelectedIndexChanged
     client-side events. Thus, I can test your scenario locally and determine what is causing the exception that you get.

    All the best,
    Kate
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Nagarajan
    Nagarajan avatar
    7 posts
    Member since:
    Aug 2010

    Posted 15 Nov 2012 Link to this post

    Thanks for the reply,

    Code in OnClientContextMenu
    ---------------------------------------------
    function showContextMenu(sender, e) {
                if (e.get_item()) {
                    var menu = $find("CategoryContextmenu1");
                    var rawEvent = e.get_domEvent().rawEvent;
                    menu.show(rawEvent);
                    e.get_item().select();
                    $telerik.cancelRawEvent(rawEvent);
                }
    }

    Code in OnClientSelectedIndexChanged 
    -----------------------------------------------------
     function Category1Listbox_OnClientSelectedIndexChanged(sender, eventArgs) {
           $find("rpanCat2").ajaxRequest(eventArgs.get_item().get_value());
    }

    .cs code
    -----------------
      protected void rpanCat2_PreRender(object sender, EventArgs e)
            {
                if (Request["__EVENTTARGET"] == rpanCat2.ClientID)
                { 
                    if (!string.IsNullOrWhiteSpace(Request["__EVENTARGUMENT"]) &&
                        Request["__EVENTARGUMENT"] != "undefined")
                    {
                        Listbox.DataSource = GetList();
                        Listbox.DataBind(); 
                    }
                }
            }

    Note: Once I remove OnClientSelectedIndexChanged  event works fine.

    Regards,
    Nagarajan.
  5. Nagarajan
    Nagarajan avatar
    7 posts
    Member since:
    Aug 2010

    Posted 15 Nov 2012 Link to this post

    When we remove ajaxRequest from OnClientSelectedIndexChanged it works fine... Is this a known issue

Back to Top