'event' is not defined

2 posts, 0 answers
  1. Vincent
    Vincent avatar
    70 posts
    Member since:
    Jul 2008

    Posted 01 Jul 2010 Link to this post

    I have copy the exact blockConfirm script in the demo, and try to use it in my custom dialog. it works fine if I put it in the button "OnClientClick" event directly.

    here is my working code snippet

    OnClientClick="return blockConfirm('The selected Dynamic Content will be deleted. Are you sure you would like to continue?', event, 450, 100,'','DELETE DYNAMIC CONTENT');" 



    However, now I need to do ajax postback to do another check and alert before I show the confirm, I changed OnClientClick to call "DeleteDynamicContent" function, and I received 'event' is not defined error.

    here is my new js

    function DeleteDynamicContent(dynamicContentID) { 
     
            PageMethods.GetTotNoOfRules( 
                dynamicContentID, 
                Validate_OnSucceeded, Validate_OnFailed); 
            return false
        } 
     
        function Validate_OnSucceeded(result) { 
            if (result == true) { 
                radalert('<%= getHelpText("Delete Dynamic Content Alert", "1a") %>', 450, 100, "DELETE DYNAMIC CONTENT"); 
                return
            } 
            else { 
                return blockConfirm('The selected Dynamic Content will be deleted. Are you sure you would like to continue?', event, 450, 100, '''DELETE DYNAMIC CONTENT'); 
            } 
     
        } 
     
        function Validate_OnFailed(error) { 
            alert(error);         
        } 



    Please help!

    Thanks

  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 01 Jul 2010 Link to this post

    Hi Vincent,

    The "blocking confirm" code is considered a hack and we don't guarantee that it will work in all scenarios. I would suggest to consider changing your code logic and to use ajaxRequestWithTarget() instead as shown in this post.

    Sincerely yours,
    Georgi Tunev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top