This is a migrated thread and some comments may be shown as answers.

Q1 2008 Radconfirm clientside script

7 Answers 270 Views
Window
This is a migrated thread and some comments may be shown as answers.
JK
Top achievements
Rank 1
JK asked on 13 May 2008, 04:11 PM
Hi,

I had a javascript snippet which checked what radmenu item was selected then it asked an "are you sure" radconfirm box.  Since migrating over to the new version (and changing some of the code as per the demo version) the rad confirm will open but then immeditely close without user intervention and continue on the ASP code.  The only other thing which is different is I am now using masterpages so I have tried putting my javascript inside a radcode block but no joy.

Here is the stages it used to do correctly:
1. User clicks on menu item.
2. Javascript identifies if the menu item needs an are you sure.
3. If the menu item is to be using a rad confirm perform radconfim
4. If user clicks on "NO" then stop.
5. If user clicks on "Yes" then c# code continues in the radmenu_click event.

Here is whats happening currently:
1. User clicks on menu item.
2. Javascript identifies if the menu item needs an are you sure. (i have added an alert command to ensure the javascript is being hit)
3. Radconfirm appears for no more than 1 second then closes
4. c# code on radmenu continues.

From my testing this is something to do with radconfirm.  Can any one help?  Below is the javascript and snippet of ASP code:

ASP
<telerik:RadMenu ID="rmReceipt" Style="z-index:1000;" runat="server" ClickToOpen="True" Skin="Telerik" OnItemClick="rmReceipt_ItemClick" OnClientItemClicking="onClicking">  
                                    <CollapseAnimation Duration="200" Type="OutQuint" /> 
                                    <Items> 
                                        <telerik:RadMenuItem runat="server" Text="Options">  
                                            <Items> 
                                                <telerik:RadMenuItem runat="server" Text="Cancel">  
                                                </telerik:RadMenuItem> 
                                                <telerik:RadMenuItem runat="server" Text="Update And Finish Later">  
                                                </telerik:RadMenuItem> 
                                                <telerik:RadMenuItem runat="server" Text="Print And Complete">  
                                                </telerik:RadMenuItem> 
                                            </Items> 
                                        </telerik:RadMenuItem> 
                                    </Items> 
                                </telerik:RadMenu> 
c#
   protected void rmReceipt_ItemClick(object sender, RadMenuEventArgs e)  
        {switch (e.Item.Text)  
            {  
                case "Print And Complete":  
                    ....  
                    RadWindow3.Title = "Receipt";  
                    RadWindow3.ReloadOnShow = true;  
                    RadWindow3.VisibleOnPageLoad = true;  
                    RadWindow3.Visible = true;  
                    RadWindow4.Visible = false;  
                    RadWindow2.Visible = false;  
                    RadWindow1.Visible = false;  
                    //produce receipt  
                    break;  
                default:  
                    break;  
            }  


JavaScript
 <script  type="text/javascript">   
    
       var itemClicked = null;     
       function HideMe(dockableObject, command)    
            {    
                  dockableObject.Hide;  
            }    
       function onClicking(sender, eventArgs)   
        {   
            var item = eventArgs.get_item();  
          
            if(item.get_text() == "Print And Complete")     
            {        
            alert ("Hello");  //Added to check that javascript is firing
               itemClicked = eventArgs.get_item();   
               radconfirm('Printing The Receipt Will Lock The LPG Equipment Details And Receipt. Please Ensure All Details Are Correct Before Proceeding. Do You Wish To Continue?',callBackFn ,500,200,'','Warning!');                                     
               return false;  
                
            }      
        }   
       function callBackFn(result)     
        {     
            if (result) //submit the item     
            {     
                eval(itemClicked.get_navigateUrl());     
            }                 
        }     
     
</script>   

Thanks in advance,

Jon

7 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 14 May 2008, 01:20 PM
Hi JK,

I believe that the following KB article will be of help:
http://www.telerik.com/support/kb/article/b454K-hmd-b454T-a-b454c-a.aspx

In this article we are using radprompt, but the logic stays absolutely the same with radconfirm as well.



Best wishes,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JK
Top achievements
Rank 1
answered on 15 May 2008, 08:59 AM
Hi,

If you look at the javascript on that page, it does not correspond with the asp code.  I.e.

asp is calling "onClientButtonClicking" but there is no reference to this in the javascript.

Please can you advise.

thanks,

JK
0
Georgi Tunev
Telerik team
answered on 15 May 2008, 02:35 PM
Hi JK,

Please re-check the KB article. The wrong name of the client-side function was fixed and the project was updated to use radconfirm as well.



Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JK
Top achievements
Rank 1
answered on 15 May 2008, 05:07 PM
WOW!

thanks for updating the KB!

But.....

I think I understand how the code it working but I get an Jscript error.  The radconfirm now pops up and clicking on "cancel" will stop the postback, but when I click on the "OK" button the radconfim stays on screen and I get a JS error message at the bottom left of statusbar(of IE) saying "object doesnt support this property or method".

Below is the Jscript code, I think its the statement "lastClickedItem.click(); " as i dont think this is used with RadMenu, if thats the case what do I need to replace it with?
 <script  type="text/javascript">   
        var lastClickedItem = null;        
        var clickCalledAfterRadconfirm = false;   
         function confirmCallbackFunction(args)     
        {                   
            if (args)     
            {       
                clickCalledAfterRadconfirm = true;    
                lastClickedItem.click();     
            }     
            else    
            {  
                clickCalledAfterRadconfirm = false;  
                lastClickedItem = null;    
            }   
        }       
        function onClientButtonClicking(sender, args)     
        {     
            if (args.get_item().get_text() == "Print And Complete")     
            {     
             if (!clickCalledAfterRadconfirm)     
                {    
                    args.set_cancel(true);     
                    lastClickedItem = args.get_item();                 
                    radconfirm("Are you sure you want to postback?", confirmCallbackFunction);     
                }   
            }     
                 
        }     
</script>   

Thanks,

Jk
0
JK
Top achievements
Rank 1
answered on 16 May 2008, 02:42 PM
Hi Telerik,

Has there been any progress with this at all?

thanks

JK
0
Georgi Tunev
Telerik team
answered on 17 May 2008, 08:41 AM
Hello JK,

The code that you used is working as expected - see attached video.
If you still experience problems, please open a support ticket and send us your project or a sample one where the problem can be reproduced - we will check it and get back to you with solution.
In addition, we strongly recommend to use the support ticketing system if you need assistance in a certain timeframe - although we closely monitor the forums, we do not guarantee a timely reply here while the support tickets are handled in the timeframe which your account and technical support option sets.



Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JK
Top achievements
Rank 1
answered on 28 May 2008, 12:15 PM
Thank you for providing me a minimal 11 second video clip!

From doing further searching I have found the cause of this problem to be far more common than this thread has provided.

Earlier in my post I commented that the Rad confim appeared but vanished as soon as it appeared.  It turns out that there is a KB article on the subject!  Normally I am extremley impressed with you guys, but this has annoyed me as the KB article clearly explains the issue. Forum post discussing the KB Article

Regarding your point about "recommend to use the support ticketing system". I do use it and in my defence this issue has come about since upgrading to 2008Q1 (i.e. it worked fine before the upgrade).   Surley the best place for these comments are on the forum to help other users to identify the problem and solve it without the headaches I have had to overcome.



Tags
Window
Asked by
JK
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
JK
Top achievements
Rank 1
Share this question
or