Delete in RadListView from ToolTip

4 posts, 0 answers
  1. Steve
    Steve avatar
    60 posts
    Member since:
    Nov 2006

    Posted 26 Aug 2011 Link to this post

    Similar to how a RadToolTipManager is used to insert a record into a RadGrid, I have a RadListView where the user clicks a button on a record to load a tooltip to see more info about the record, including some function buttons (namely, the "Delete" button).  Because other controls update both the listview and the tooltipmanager via ajax, both controls are included in RadAjaxManagerProxy ajax settings on the page.  When user clicks "Delete" in the tooltip, the record should be removed from the database, tooltip hidden, and parent listview updated.  Everything is working except for updating the listview.

    How do you setup ajax settings so a button in the tooltip (loaded dynamically on tooltipmanager's AjaxUpdate event) can ajax update it's parent control?
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 26 Aug 2011 Link to this post

    Hi Steve,

      The user control renders as a part of the main page, thus it can access JavaScript functions that reside in it. What I would suggest is that you declare one function that will perform an AJAX request via the RadAjaxManager with some custom argument (for example "FromTooltip") so that you can differentiate this request in the code-behind. Then in the AJAX settings you should add the ListView to the UpdatedControls collection of the setting, whose initiator is the RadAjaxManager (or create this setting, if it is not present already). In the code-behind you can check the argument and rebind the ListView.


    Regards,
    Marin
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Steve
    Steve avatar
    60 posts
    Member since:
    Nov 2006

    Posted 26 Aug 2011 Link to this post

    That's a good idea, but that didn't work either.  The "Delete" button in the tooltip has to first delete the record from the database on the server-side.  Then when the call has completed successfully, I have to inject javascript to call the InitiateAsyncRequest function that performs the ajax request (with RadAjaxManager is the initiator), so that means the Delete button has to have an ajax setting on a RadScriptBlock so I can get the script in there.  After doing all this, I was successfully able to initiate the request, handle in an AjaxRequest event handler, and call to update the listview.  But essentially, the request never seems to finish.  If you use loading panel, it never goes away.  If you try to do another action on screen that involves ajax, it hangs.  You have to clear it by F5 (or something similar that fully posts back the page).

    This is driving me crazy.  Simple situation.  RadListView showing items, using RadToolTipManager to "show more".  Function available in the usercontrol showing in the tooltip that requires the "parent" RadListView to be refreshed, and I can't get it working.  Not good.
  5. Steve
    Steve avatar
    60 posts
    Member since:
    Nov 2006

    Posted 26 Aug 2011 Link to this post

    Hold the phone, I think I may have figured it out.  In the tooltip usercontrol, instead of ajaxifying RadScriptBlock to inject script to call the InitiateAsyncRequest function, I took all AJAX settings out of the tooltip and used the ScriptManager to RegisterClientScriptBlock and, low and behold, it worked.

    Still have to check it out to be sure, but I believe it's straight.  Thanks for the suggestion about RadAjaxManager.
Back to Top