Does anyone have a sample of using the Dialog object to mimic a javascript confirm alert? I've got it set up with Ok and Cancel buttons. Where I'm stuck is in having the Cancel actually return false to the calling link. The javascript function which shows the Dialog can't call get_result until AFTER the Ok or Cancel have been clicked.
Here's my code: (master page)
<ComponentArt:Dialog id="caConfirm" Modal="true" runat="server" HeaderClientTemplateId="HeaderClientTemplate1" ContentClientTemplateId="ContentClientTemplate1"
AnimationType="Live" ShowTransition="Fade" AnimationSlide="ExponentialDecelerate"
CloseTransition="Fade" ModalMaskImage="images/alpha.png" AnimationDuration="600" >
<ClientTemplates>
<ComponentArt:ClientTemplate id="HeaderClientTemplate1">
## Parent.Title ##
< /ComponentArt:ClientTemplate>
< ComponentArt:ClientTemplate id="ContentClientTemplate1">
## Parent.Content ##
<center><br />< input type='button' onclick='## Parent.Id ##.Close(true);' value='OK' /> < input type='button' onclick='## Parent.Id ##.Close(false);' value='Cancel' />< /center>
< /ComponentArt:ClientTemplate>
< /ClientTemplates>
< /ComponentArt:Dialog>
Code-behind:
caConfirm.ClientEvents.OnClose = new ComponentArt.Web.UI.ClientEvent("confirmReturn");
this.Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ConfirmReturn", "function confirmReturn() {" + String.Format("return {0}.get_result();", caConfirm.ClientID) + " }", true);
// this is client side, so have to provide the javascript function
this.Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ConfirmFlare", "function confirmFlare(confirmText,confirmHeader) {" + String.Format("{0}.Show(confirmText,confirmHeader);", caConfirm.ClientID) + " }", true);
Thanks for your help!