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

How do I use radconfirm with asp:LinkButton's OnClientClick?

4 Answers 585 Views
Window
This is a migrated thread and some comments may be shown as answers.
bemara57
Top achievements
Rank 1
bemara57 asked on 23 Apr 2008, 09:26 PM
I'm trying to use the radalert instead of the browser confirm alert. Normally I would put this in the OnClientClick: return confirm('Are you sure you want to delete this file?');. But this does not work with radalert. I tried the below but nothing worked, mostly they just show the confirm window and it disappears after a second then the page continues to post without me even answering the confirm question. How do I achieve this?

OnClientClick="return radconfirm('Are you sure you want to delete this file?', confirmCallBackFn);"
OnClientClick="radconfirm('Are you sure you want to delete this file?', confirmCallBackFn);"
OnClientClick="radconfirm('Are you sure you want to delete this file?', confirmCallBackFn); return false;"
OnClientClick="return radconfirm('Are you sure you want to delete this file?', confirmCallBackFn); return false;"

<script>
function confirmCallBackFn(arg)
{
    return arg;
}
</script>

4 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 25 Apr 2008, 09:44 AM
Hello Basem,

If you do not return false after executing the function in the linkbutton's OnClientClick handler the page will perform a postback and the confirm will not wait until you answer the question. Therefore the correct approach is the following one:

 <asp:linkbutton ID="Linkbutton1" runat="server" OnClientClick="radconfirm('Are you sure you want to delete this file?', confirmCallBackFn); return false;" 
>LinkButton</asp:linkbutton> 

Please, try it again and in case it does not work as expected, open a new support ticket and send us a sample project with a detailed explanation of the desired behavior and we will modify it in order to meet your requirements.

Best wishes,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Sharbel Lutfallah
Top achievements
Rank 1
answered on 08 May 2008, 01:49 AM
I am fighting with the same issue.  True putting return false in the LinkButton will stop the page from posting-back so the cb function can be called, however it will still not give the desired result of posting back if the user clicks the OK in the radconfirm window.

The flow the OP and I are trying to achieve is this:

1) user clicks a delete button
2) radconfirm window comes up and asks to confirm delete
3) user clicks OK
4) Page continues with postback because user clicks OK

This does not work.... i did see some old posts for RadWindow1 regarding putting in some lengthy javascript to simulate a browser confirm(), do we still have to do this with the new ASP.NET AJAX RadWindow?  If so, I really think its a shame...
0
bemara57
Top achievements
Rank 1
answered on 08 May 2008, 02:10 AM
Check this out: http://www.telerik.com/community/code-library/submission/b311D-gbaga.aspx

It worked like a charm!
0
Alice
Top achievements
Rank 1
answered on 28 Feb 2017, 02:46 PM
This page doesn't exist anymore. Can you let me know what is the solution?
Tags
Window
Asked by
bemara57
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Sharbel Lutfallah
Top achievements
Rank 1
bemara57
Top achievements
Rank 1
Alice
Top achievements
Rank 1
Share this question
or