Welcome Guest Search | Active Topics | Sign In | Register

How do initiate a callback from a Dialog ClientSideOnAccept Options
Roger Jordan
Posted: Tuesday, November 26, 2013 7:39:40 AM
Rank: Member
Groups: Member

Joined: 12/29/2008
Posts: 29
Hi,

1)
I tried to do a callback from inside the ClientSideOnAccept of a Dialog object. I try __doPostBack and that works, but as it's inside an update panel I don't really want to do a postback, I only want to call a server side method. The Dialog doesn't seem to have a client method like "raiseEvent..."

Do I have to use a Callback object for this? Did you have an example on how to do this? I can't find an example in dokumention.

2)
How to prevent that the whole side reloads after showing a Dialog and close this Dialog with a click on a button? (everything is inside an update panel)

Many thanks for your help.

Best regards
Roger
eo_support
Posted: Tuesday, November 26, 2013 9:24:54 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

Yes. You can use CallbackPanel to do the Callback. You may also want to use ScriptEvent together with CallbackPanel if you are looking for a "raiseEvent" style call. You can take a look of the samples/documentation for them to see how it works.

The issue of preventing the whole page reload has nothing to do with the dialog. In another word, to prevent the page reload, you do what you do when you are not using the dialog. For example, CallbackPanel/UpdatePanel is one way to achieve this goal, then that should work with/without the dialog. Another way is to use a simple HTML button instead of a server button because a server button would post back but a simple HTML button won't, this also should work with/without the dialog.

Hope this helps.

Thanks!
Roger Jordan
Posted: Tuesday, November 26, 2013 10:52:01 AM
Rank: Member
Groups: Member

Joined: 12/29/2008
Posts: 29
I'm sorry, I do not understand how to use the CallbackPanel together with the Dialog. I have had a look in the samples, but do not understand how to do. I have to regisiter Triggers but don't know which.

I want a Dialog to call a server method as callback after click on the AcceptButton. Did you have any furthe advice for me?

Thanks in advance and sorry for inconvinience.

Best regards,
Roger
eo_support
Posted: Tuesday, November 26, 2013 11:04:23 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

What you have to do is to leave the dialog out of the picture. There is no such thing as "use the CallbackPanel together with the Dialog". The dialog is the dialog, the CallbackPanel is the CallbackPanel. These are two different, unrelated things. If you want the dialog to close and trigger a callback, first you make the dialog close by following the dialog's sample/documentation, second you trigger the callback by following the CallbackPanel documention. Do not mix them together.

One way for you to call server method after AcceptButton is to handle the dialog's ClientSideOnAccept. It will be something like this for the dialog:

Code: HTML/ASPX
<eo:Dialog ClientSideOnAccept="on_accept" ...>
....
</eo:Dialog>


Code: JavaScript
function on_accept(dialog, args)
{
   //write code here to trigger callback
   ....
}


Here by setting ClientSideOnAccept="on_accept", it instructs the dialog to call your on_accept (you can name it anything) JavaScript function when the accept button is clicked --- this part has to do with the dialog. You can then write code inside your own on_accept button to do anything, for example, to trigger an AJAX callback to call your server side code ---- and what you do inside your on_accept handler obviously no longer has anything to do with the dialog.

As you can see, the key is to keep unrelated thing separate.

Thanks!
Roger Jordan
Posted: Wednesday, November 27, 2013 5:43:58 AM
Rank: Member
Groups: Member

Joined: 12/29/2008
Posts: 29
Thanks for your support. I got it to work now!

Best regards,
Roger
eo_support
Posted: Wednesday, November 27, 2013 9:20:01 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Great. Glad to hear that you got it working!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.