Ajax Handling of Custom Command for Dynamic Dock with User Control

8 posts, 0 answers
  1. LeBear
    LeBear avatar
    233 posts
    Member since:
    May 2006

    Posted 20 Jun 2007 Link to this post

    Hello,

    I just have to say that I'm extremely pleased with Prometheus.  The Dock controls themselves seem to address all that I wanted to see.  Of course, with that, I seem to always want more!  :)

    I'm creating dynamic docks, where each dock has a custom user control (ascx), and it works great.  I can add and delete docks at will, and it all comes together perfectly.

    I have what I call a Portal Manager that reads user information from the database and creates that user's personal docks.  As read from the database, each dock references a user control (ascx).  The Portal Manager creates an instance of the user control, passes in a number of standard properties, and the user control displays as it should.

    One of the properties I pass into the user controls is the AjaxManager that exists on the page.  Thus, the user control can add Ajax Settings that cause certain functionality on the user control to be executed via Ajax.  Awesome!  I added a "Configuration" button onto one of these user controls.  When clicked, the content of the user control is swapped with a configuration window, when the user saves their configuration, it's saved on the server (via Ajax) and the contents of the dock are replaced with the updated content based on the user's configuration changes.  This works perfectly, but I want to take it a step further.

    I would like to add a custom command to the dock.  When the user clicks on the custom command, I want it to work just as the Ajaxified button.  I want the contents of the dock to be replaced with the configuration window without doing a postback.  Is that possible?  I think I might be kind of close in looking at the DockCommandEventHandler, but I don't see how to wire it in nor if it's possible to Ajaxify it.

    Any assistance would be appreciated.

    Thanks!
  2. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 25 Jun 2007 Link to this post


    Hi Barry,

    Please find an attached example illustrating how to add a UserControl in RadDock and customize it via ajax, on customCommand click.
    The scenario is:
    1. RadDock is created dynamically.
    2. UpdatePanel is added dynamically In RadDock
    3. UserControl  is added dynamically In  UpdatePanel  
    4. UserControl has two panels (customize and view). When you click on customCommand, visibility of these panels is changed via AJAX.

    I hope that this example will help you to achieve your goals. If you have any questions ,please let us know.


    Best Regards,
    Petio
    the Telerik team


    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. LeBear
    LeBear avatar
    233 posts
    Member since:
    May 2006

    Posted 25 Jun 2007 Link to this post

    Thank you very much.

    I stumbled over the assigning of the DockCommandEventHandler because I'm using VB and not C#, but I got passed that.

    I also had not been using the UpdatePanel object, but it appears that in order to Ajaxify this, you need to create the AsyncPostBackTrigger, which must be added to the triggers of an UpdatePanel.  Can you confirm this is in fact true and that you need an AsyncPostBackTrigger and it needs to be added to the triggers of an UpdatePanel?

    Finally, I am running into a problem.  I'm seeing text above the user controls that seems to be related to the UpdatePanel the UC is contained within.  For example, above the content of my UserControl, I see this:

    1233|updatePanel|5_C_Gadget_5_MainContentPanel|

    or on another:

    772|updatePanel|3_C_Gadget_3_Main_ContentPanel|

    Interestingly, this funky text appears above the UC that last initiated an Ajax call.  When the page loads, I don't see it.  However, an automatic Ajax call updates the content of one user control quite quickly, and then I see the text above that UC.  If I click on the Ajaxified button of another UC, the text disappears from the previous UC and now appears above the UC output where I clicked on the Ajaxified button.  I didn't see this without the UpdatePanel.  Note that when I click on the Ajaxified command button/image for the RadDock, I don't see this text, either.

    Any thoughts??

    Thanks!

  5. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 28 Jun 2007 Link to this post

    Hello Barry,

    Yes, you must create AsyncPostBackTrigger, which must be added to the triggers collection of an UpdatePanel . More info you can find here.

    Unfortunately I I am not quite sure about your problem with UserControls as the provided information is not enough. Please open a new support ticket and send us simple running project where this issue can be observed and we will do our best to help you.



    Greetings,
    Petio Petkov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. LeBear
    LeBear avatar
    233 posts
    Member since:
    May 2006

    Posted 28 Jun 2007 Link to this post

    I'm going to put this on the back-burner for a while and just use a configuration button within the UC for now.  When I do come back to it, I'll either send some sample code to reproduce this or post my solution.

    I have, however, been thinking about this today.  It seems that I'm potentially running into an incompatibility between using ASP.Net Ajax with the UpdatePanel and the RadAjaxManager.  Here's what I'm thinking...

    If I don't use the UpdatePanel, and instead just use the RadAjaxManager, I can have a button inside of the UC that is Ajaxified to provide the user with a configuration window.  If I then add the UpdatePanel to be able to implement the DockCommand, it works, but the Ajaxified button starts to exhibit problems.

    I'm thinking that if I want an Ajaxified button in the UC, and I'm using an UpdatePanel, that I have to register the button with the Panel and that the RadAjaxManager isn't the way to go in this scenario.  Is that possible?

    I post this in case it triggers an idea.  If not, as I said, I'll pursue this a little later.

    Thanks.
  7. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 05 Jul 2007 Link to this post

    Hi Barry,

    I 'd suggest going with RadAjaxManager only. It can handle the ajaxification of the whole application. You won't need to add triggers as well.

    Actually there is a limitation concerning the use of panels (UpdatePanel, RadAjaxPanel) along with RadAjaxManager controls. Say there is a button inside an AJAX Panel (no matter MS UpdatePanel or RadAjaxPanel). If you add this button into RadAjaxManager AJAX settings to be ajaxified, it won't get the desired result as the button has been already ajaxified by the panel.

    So we always recommend ajaxify your scenario via single RadAjaxManager control. You can also add and configure  RadAjaxManagerProxy control in User Controls scenario like in this online demo here:

    http://www.telerik.com/demos/aspnet/prometheus/Ajax/Examples/Manager/UserControl/DefaultVB.aspx

    I hope this information helps. Should you need additional help, do not hesitate to write back to us.

    Kind regards,
    Konstantin Petkov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  8. adam
    adam avatar
    20 posts
    Member since:
    Dec 2007

    Posted 17 Mar 2008 Link to this post

    Hi Barry,
    We have run into a similar scenario where we have UserControls loaded into Docks and the UserControls use the telerik ajax controls as oppose to the MS UpdatePanel.

    We would like to ajaxify the Commands on the docks without using the UpdatePanel 'AsyncPostBackTrigger' method because of the inherit incompatibilites between MS Ajax and Telerik Ajax.  Were you able to find a similar way to accomplish this with Telerik controls?

    I noticed that the AjaxSetting class has a property named 'EventName' and I was hoping that it could function similar to the AsyncPostBackTrigger class.  I am currently waiting on telerik to reply to my questions regarding this HERE but if you have insight on this issue, would you mind sharing??

    Thanks!

  9. LeBear
    LeBear avatar
    233 posts
    Member since:
    May 2006

    Posted 17 Mar 2008 Link to this post

    I'm doing this fairly differently now.  All of the buttons and scheduled actions on the page that I want to trigger an Ajax action make a call to a JavaScript routine.

    So, for the dock's command button, I use the onClientCommand property to call a custom JavaScript routine.  This routine (indirectly) calls Ajax Manager's AjaxRequestWithTarget method.

    I think this should get you where you want to go.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017