Add a confirm on dockCommand using radWindow

6 posts, 0 answers
  1. CSurieux
    CSurieux avatar
    465 posts
    Member since:
    Jan 2007

    Posted 09 Apr 2009 Link to this post

    Hello,

    I have enabled a general confirm using radwindows radconfirm but I am unable to have it working with OnClientCommand.
    Any idea how to do this ?

    Thanks
    CS
  2. Obi-Wan Kenobi
    Obi-Wan Kenobi  avatar
    460 posts
    Member since:
    Aug 2007

    Posted 09 Apr 2009 Link to this post

    The code below illustrates how to show a RadConfirm when a RadDock's custom command is clicked.

    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head runat="server">  
        <title>Untitled Page</title> 
        <script type="text/javascript">  
            function confirmCallBackFn(arg) {  
                radalert("<strnog>radconfirm</strong> returned the following result: <h3 style='color: #ff0000;'>" + arg + "</h3>", null, null, "Result");  
            }  
     
            function ShowConfirm(dock, args)   
            {  
                radconfirm('<h3 style=\'color: #333399;\'>Are you sure?</h3>', confirmCallBackFn, 330, 100, null, 'RadConfirm custom title');   
                return false;  
            }  
        </script> 
    </head> 
    <body> 
        <form id="form1" runat="server">  
            <asp:ScriptManager ID="ScriptManager1" runat="server">  
            </asp:ScriptManager> 
            <div> 
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server">  
                </telerik:RadWindowManager> 
            <telerik:RadDockLayout ID="RadDockLayout1" runat="server">  
                <telerik:RadDockZone ID="RadDockZone2" runat="server" Width="400px"   
                Orientation="Vertical" style="padding-bottom: 30px">                 
                    <telerik:RadDock ID="RadDock1" runat="server" Text="RadDock1" Title="RadDock1" 
                     Height="200px" Skin="Default">  
                    <Commands> 
                        <telerik:DockCommand Name="DockConfirm" OnClientCommand="ShowConfirm"/>  
                    </Commands> 
                    </telerik:RadDock> 
                </telerik:RadDockZone> 
            </telerik:RadDockLayout> 
            </div> 
        </form> 
    </body> 
    </html> 

     

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. CSurieux
    CSurieux avatar
    465 posts
    Member since:
    Jan 2007

    Posted 10 Apr 2009 Link to this post

    Thanks again, but it doesn't cover my case: I have a callback on this command, this code is not relevant to stop the callback.
    I am using the traditionnal and unofficial Telerik turn over for this non blocking defect of RadConfirm, replacing radConfirm with another function which try to  call callerobject.click or eval(callerObject,href).  (see forums for detail).
    But it doesn't work with dockcommands, so I am searching a way to include radcommand in this new blocking radconfirm.
    Same problem with context menus anywhere....

    I am still expecting Telerik to provide us with a radConfirm blocking solution working with every rad control subject to send callback.

    CS
  5. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 13 Apr 2009 Link to this post

    Hi Christian,

    The following code-library provides extensive information on the "blocking the browser execution thread" issue:
    http://www.telerik.com/community/code-library/aspnet-ajax/window/block-the-execution-thread-with-radconfirm.aspx

    You will notice that contrary to all the details provided, every once in a while there is a comment from someone claiming that this functionality is implemented in a difficult manner and can be made easier to use, as well as claims suggesting that in fact, it would be somehow possible to block the browser execution thread... if only Telerik wanted to try. Unfortunately, neither of this is true. Despite our best efforts.

    In addition, there is no universal solution that can cover all scenarios in the same manner. So, technically speaking, "I am still expecting Telerik to provide us with a radConfirm blocking solution working with every rad control subject to send callback."  is not likely to happen any time soon.

    To keep a long story short (you can read the longer version in the provided thread):
    1) radconfirm cannot block the browser execution thread like buil-in browser confirm can.
    2) In some scenarios, however, it is possible to simulate as if this happens.
    3) However, in many more scenarios this is not possible - then, in case you wish to use radconfirm instead of confirm, you will need to provide a callback function to be called after the uses closes the popup.

    The Dock scenario is just one such case (#3)

    Greetings,
    Tervel
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  6. CSurieux
    CSurieux avatar
    465 posts
    Member since:
    Jan 2007

    Posted 22 Apr 2009 Link to this post

    Hi Tervel,

    I appreciate your answer but I am not totally satisfyed.
    I finally found a 'one shoot solution' for commands in raddock and context menus in Treeview, based on several posts in Telerik forums and knowledge base, cost was a wast of my time on a non central pb, risk level: a one shot solution subject to change on a telerik change of API.
    I am sure there is something to do here: using OOD since before C++, I am used to the interface/protocol concept.
    I think that all telerik objects should adhere to a 'Confirm' interface which could bring a common ways of stopping an event and recalling it after confirm, independantly from browsers.
    We should not have to add local javascrip vars and scripts in our pages, this should be assumed by some lib: your's or something standard.
    Hope this message will do its way to action center.

    Anyway thanks again for your time.

    CS
  7. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 24 Apr 2009 Link to this post

    Hi Christian Surieux,

    I am glad to know that you were able to implement a solution that fits your requirements using similar solutions in the forum.

    Having such a "confirm" interface would be indeed a good solution across the Telerik product line.
    When making decisions, there are more factors that need to be taken into consideration - such as is it a good idea to add (a lot of) extra code to the controls for a scenario that is not so common.
    To avoid the controls becoming bloated, slow and their maintenance - out of hand - the RadControls for ASP.NET AJAX focuses on maximum performance, and leaving some features out of the core control script - while still making it possible to "plug" with some extra code.

    In this particular case it is a bit deceptive to compare server interfaces with their "client-side" counterparts. Also, the basic event logic, registration, maintenance etc. is modeled after and uses the built-in ASP.NET AJAX client-side framework event support.

    It makes good sense, however, to at least provide a more complex radconfirm example featuring several RadControls. I have logged this to our TODO list, and I hope we will be able to add this example soon.


    Best regards,
    Tervel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017