Welcome Guest Search | Active Topics | Sign In | Register

Dialog Close Button. Options
Thiago Diniz
Posted: Friday, April 17, 2009 3:39:50 PM
Rank: Newbie
Groups: Member

Joined: 2/5/2009
Posts: 5
Hello,

I would like to know, how can i handle with the Dialog Close button click event? I need to call a Server side function when the client click on the Dialog Close button.

eo_support
Posted: Friday, April 17, 2009 3:44:15 PM
Rank: Administration
Groups: Administration

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

You would just put a regular button inside the dialog and use it the same way as with any other button. The button would have nothing to do with the dialog except for that it is placed inside the dialog. When user clicks the button, the page posts back and trigger your server side event. The dialog automatically closes when the page posts back.

Thanks
Thiago Diniz
Posted: Saturday, April 18, 2009 12:53:52 AM
Rank: Newbie
Groups: Member

Joined: 2/5/2009
Posts: 5
Hello again,

Ok, but I want to do it using the pre-build Dialog Close Button placed at the top-right on the Dialog. Is it possible?

Thanks
eo_support
Posted: Saturday, April 18, 2009 7:36:21 AM
Rank: Administration
Groups: Administration

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

The close button does not trigger any server event directly. However it does trigger client side JavaScript event:

http://doc.essentialobjects.com/library/1/eo.web.dialog.clientsideoncancel.aspx

You can write a JavaScript handler for this event and then trigger a post back from your JavaScript code (for example, calling __doPostBack). You will need to code accordingly so that your server side code can distinguish the post back is from your JavaScript code.

Thanks
Thiago Diniz
Posted: Saturday, April 18, 2009 3:38:00 PM
Rank: Newbie
Groups: Member

Joined: 2/5/2009
Posts: 5
Hi,

Ok, I got it! But, now the problem is I'm writing the javaScript _doPostBack on the dialog.ClientSideOnCancel and it doesnt trigger anything. Do I have to set as True any PostBack property of the dialog?

My code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim PostBackStr As String
PostBackStr = Page.ClientScript.GetPostBackEventReference(Me, "ClosePostBack")

Dialog2.ClientSideOnCancel = PostBackStr

If Page.IsPostBack Then
Dim eventArg As String = Request("__EVENTARGUMENT")
If eventArg = "ClosePostBack" Then
MsgBox("It works!")
End If
End If

End Sub

Thanks,
eo_support
Posted: Sunday, April 19, 2009 11:05:27 AM
Rank: Administration
Groups: Administration

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

ClientSideOnCancel takes a JavaScript function name, not Javascript code. So you will need to have a client side JavaScript function first.

Thanks


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.