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

problem with radconfirm

3 Answers 95 Views
Window
This is a migrated thread and some comments may be shown as answers.
usr9999
Top achievements
Rank 1
usr9999 asked on 16 Jul 2010, 08:59 PM
Hi,

I am using the code from the following link for confirming the postback with radconfim. Some how the code sample works fine on the test page but when i integrate it in my existing page the confirmation window shows but will not execute the "PostbackButton1_Click" event from the code behine. My existing page uses Radtabstrip, Radmultipageview and also the RadAjaxManager.  Any clue why it may not be working. I could not upload code from existing file as it is very big.  Any help is appreciated.

 

 

 
http://demos.telerik.com/aspnet-ajax/window/examples/browserdialogboxes/defaultcs.aspx

Code

 

 

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">

 

 

 

</telerik:RadWindowManager>

 

 

 

<script type="text/javascript">
            //the following code use radconfirm to mimic the blocking of the execution thread.
            //The approach has the following limitations:
            //1. It works inly for elements that have *click* method, e.g. links and buttons
            //2. It cannot be used in if(!confirm) checks
            window.blockConfirm = function (text, mozEvent, oWidth, oHeight, callerObj, oTitle)
            {
                var ev = mozEvent ? mozEvent : window.event; //Moz support requires passing the event argument manually
                //Cancel the event
                ev.cancelBubble = true;
                ev.returnValue = false;
                if (ev.stopPropagation) ev.stopPropagation();
                if (ev.preventDefault) ev.preventDefault();

                //Determine who is the caller
                var callerObj = ev.srcElement ? ev.srcElement : ev.target;

                //Call the original radconfirm and pass it all necessary parameters
                if (callerObj)
                {
                    //Show the confirm, then when it is closing, if returned value was true, automatically call the caller's click method again.
                    var callBackFn = function (arg)
                    {
                        if (arg)
                        {
                            callerObj["onclick"] = "";
                            if (callerObj.click) callerObj.click(); //Works fine every time in IE, but does not work for links in Moz
                            else if (callerObj.tagName == "A") //We assume it is a link button!
                            {
                                try
                                {
                                    eval(callerObj.href)
                                }
                                catch (e) { }
                            }
                        }
                    }

                    radconfirm(text, callBackFn, oWidth, oHeight, callerObj, oTitle);
                }
                return false;
            }
        </script>

<asp:Button CssClass="PostbackButton" ID="PostbackButton1" runat="server" Style=""
Text="Confirm postback with radconfirm" OnClientClick="return blockConfirm('Are you sure you want to postback?', event, 330, 100,'','Custom title');"
OnClick="PostbackButton1_Click" />

3 Answers, 1 is accepted

Sort by
0
usr9999
Top achievements
Rank 1
answered on 17 Jul 2010, 06:06 AM
I found the issue with my page. The issue is with the RadScriptManager controls.  Thanks.
0
Tom M
Top achievements
Rank 1
answered on 29 Jul 2010, 10:15 PM
hi usr9999,

Would you mind elaborating on your resolution? I can't seem to get this to work either even thought it seems I have it setup correctly.

Thanks,
Tom
0
usr9999
Top achievements
Rank 1
answered on 30 Jul 2010, 02:22 PM
Hi
The code worked ok standalone but when I put it in my existing page where I needed the functionality, it didn’t work. On my page, i have RadTabStrip and RadMultiPage controls. The following was my code for RadAjaxManager. I didn’t need the second set of AjaxSettings with controlID as RadMultiPage1. I have removed it and the code worked fine.
   <telerik:RadAjaxManager ID="RadAjaxManager2" runat="server">
      <AjaxSettings>
         <telerik:AjaxSetting AjaxControlID="RadTab1">
              <UpdatedControls>
                  <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" />
              </UpdatedControls>
         </telerik:AjaxSetting>
         <telerik:AjaxSetting AjaxControlID="RadMultiPage1">
              <UpdatedControls>
                  <telerik:AjaxUpdatedControl ControlID="RadTab1" />
              </UpdatedControls>
         </telerik:AjaxSetting>
      </AjaxSettings>
   </telerik:RadAjaxManager>
 I had the same problem on another page which is unresolved.   I was using a grid with paging. My AJAX setting as follows.   I need this functionality so, I could not eliminate it. The problem is still there for me.
         <telerik:AjaxSetting AjaxControlID="Grid1">
              <UpdatedControls>
                  <telerik:AjaxUpdatedControl ControlID="Grid1" />
              </UpdatedControls>
         </telerik:AjaxSetting>
Hope this helped.

Regards
Tags
Window
Asked by
usr9999
Top achievements
Rank 1
Answers by
usr9999
Top achievements
Rank 1
Tom M
Top achievements
Rank 1
Share this question
or