I have scenarios like :
I wanted to confirm this confirm to radconfirm. so I wrote a code like :
As radconfirm is non-blocking so an alert with "Cancelled" is always prompted without waiting for the value set from the radconfirm.. I can't do all the works in confirmCallbackFunction function because I will have some local variables in hello() function. In this case how can I use blocking radcofirm ?
I mean , I want to block the further code processing until a button is clicked from the confirm. I want the further codes to be processed after clicking one button in confirm. Thanks in advance for your help.
function hello() {if(confirm("hello"))alert("yes");elsealert("no");}I wanted to confirm this confirm to radconfirm. so I wrote a code like :
function hello(){ showconfirm(); if (test) { alert("yes");//Here I might use some local variables } else alert("Cancelled");//Here I might use some local variables } function showconfirm() { radconfirm("Hello", confirmCallbackFunction); } function confirmCallbackFunction(arg) { test = arg; }As radconfirm is non-blocking so an alert with "Cancelled" is always prompted without waiting for the value set from the radconfirm.. I can't do all the works in confirmCallbackFunction function because I will have some local variables in hello() function. In this case how can I use blocking radcofirm ?
I mean , I want to block the further code processing until a button is clicked from the confirm. I want the further codes to be processed after clicking one button in confirm. Thanks in advance for your help.
5 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 04 Nov 2013, 05:26 AM
Hi Asif,
Please have a look into the following sample code I tried for your scenario.
ASPX:
JavaScript:
Thanks,
Shinu.
Please have a look into the following sample code I tried for your scenario.
ASPX:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager><telerik:RadButton ID="RadButton1" runat="server" Text="Click" OnClientClicking="confirmClick" OnClick="RadButton1_Click"></telerik:RadButton>JavaScript:
<script type="text/javascript"> var test; function confirmClick(sender, args) { function callBackFunction(arg) { test = arg; if (test == true) { alert("Yes"); $find("<%=RadButton1.ClientID %>").click(); } else { alert("Cancelled"); } } radconfirm("Are you sure?", callBackFunction, 300, 160, null, "RadConfirm"); args.set_cancel(true); }</script>Thanks,
Shinu.
0
Asif
Top achievements
Rank 1
answered on 04 Nov 2013, 06:17 AM
Please Consider my scenario :
function chkIsGlobal_Click(checkbox) { var chkBox = document.getElementById(checkbox); var retVal = false; if(chkBox.checked == true) { if( document.getElementById('<% = hfShowExclusive.ClientID %>').value != "false") { radconfirm("Hello", function ConfirmCallBack(arg) { if (arg) retVal = true; else { chkBox.checked = false; retVal = false; } }, 500, 120, null, ""); } else { retVal = true; } } else retVal = true; alert(retVal); return retVal; //returning false as }
and this is introduced from code behind.
chkGlobal.Attributes.Add("onClick", "if(!chkIsGlobal_Click('" + chkGlobal.ClientID + "')) return;");
the radconfirm window appears..But without waiting for the result decided from the prompt the code is returning a value false. How can I solve this porblem ?0
Shinu
Top achievements
Rank 2
answered on 05 Nov 2013, 08:57 AM
Hi Asif,
RadWindowManager's popups such as radconfirm cannot block the execution thread like the standard browser popups (confirm, prompt, alert) - this is something that cannot be done with JavaScript. That is why with radconfirm and radprompt a ClientCallBack function is used in which (after user's input) the logic should continue. Please check the following code.
JavaScript:
Thanks,
Shinu.
RadWindowManager's popups such as radconfirm cannot block the execution thread like the standard browser popups (confirm, prompt, alert) - this is something that cannot be done with JavaScript. That is why with radconfirm and radprompt a ClientCallBack function is used in which (after user's input) the logic should continue. Please check the following code.
JavaScript:
<script type="text/javascript"> function chkIsGlobal_Click(checkbox) { var chkBox = document.getElementById(checkbox); var retVal = false; function callBackFunction(arg) { if (arg) { retVal = true; } else { retVal = false; chkBox.checked = false; } alert(retVal); return retVal; } if (chkBox.checked == true) { if (document.getElementById('<% = hfShowExclusive.ClientID %>').value != "false") { radconfirm("Are you sure?", callBackFunction, 300, 160, null, "RadConfirm"); } else { retVal = true; } } else { retVal = true; } }</script>Thanks,
Shinu.
0
Asif
Top achievements
Rank 1
answered on 06 Nov 2013, 04:01 AM
Hi Shinu,
Thanks for your reply. I have tried you code. A confirm window appears but without waiting for ok or cancel being clicked it returns 'undefined' ; When I click ok or cancel it doesn't return any thing. Can you please help ? Thanks in advanced.
Thanks for your reply. I have tried you code. A confirm window appears but without waiting for ok or cancel being clicked it returns 'undefined' ; When I click ok or cancel it doesn't return any thing. Can you please help ? Thanks in advanced.
0