somePage.aspx
<asp:LinkButton Runat="server" ID="butDelete" CommandName="Delete" OnClientClick="Confirmation();return flag;"><img src="images/delete.gif" border="0" title='<asp:Literal runat="server" Text="<%$ Resources:ClarityResources, resDelete %>" />'></asp:LinkButton>
ClientSideCode.js
function confirmCallBackFn(sender) {
debugger;
if (sender)
flag = true;
else
flag = false;
return flag;
}
function Confirmation(sender,args) {
debugger;
radconfirm('Are you sure you want to delete this file?', confirmCallBackFn);
}
but the on click always returns false which is default value set for the flag variable When i did debugging i seen that the on client click the method confirmation gets called and it returns the default value false to the control and after clicking on the confirmation box's Yes or cancel it again runs the call back method confirmCallBackFn(sender) seperatly which returns flag but not in same thread but in different thread. I tried different ways to solve it but i am stuck . so any help would be great .
You're trying to treat the radconfirm in the same way as a plain javascript confirm(), this isn't done in a like-for-like manner. I'll start with the Confirmation function.
To ensure that it doesn't automatically post back the above function should be changed as follows:
The next step is correcting the call back function; The parameter passed into the function, as can be seen from the code rather than the parameter name is the boolean representation of the result from the confirmation box.
The previously written function returns a value, but this isn't used anywhere. The following code will perform the required action
Unfortunately as the sender is not passed into the callback function it is necessary to declare the function within the other JavaScript function as follows:
You might find the following link useful in regards to using the radconfirm in the same way as a confirm:
http://demos.telerik.com/aspnet-ajax/window/examples/confirmserverclicks/defaultcs.aspx.