Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Generic Modal Dialog

$
0
0
Re: Generic Modal Dialog
Web Connection 5.0
Re: Generic Modal Dialog
Apr. 13, 2013
03:31 pm
3RE0XA74HShow this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:Luca

There is no MessageBox property on the wwModalDialog control or on the script plugIn. Using the control you call the show() method to display the dialog using script code:

<script>function clickHandler() { MessageBox.show(); }</script>

If you want to create a generic dialog that doesn't depend on any control use:

<script> $.modalDialog("Header","Body goes here",["Ok","Cancel"],function() {var btnText = $(this).val();if (btnText == "Ok") alert("ok clicked");else alert("dialog canceled"); });</script>

For this you don't need the control on the page.

With your code of a control on the page:

<input type="button" id="btnShowMsgBox" name="btnShowMsgBox" value="Show Modal Dialog" />


<ww:wwModalDialogID="MessageBox"runat="server" CssClass="dialog boxshadow" OnClientDialogClick="onMessageBoxClick"Style="background: white; display: none; border-width:0; width: 400px;"><divid="MessageBoxHeader"class="dialog-header">Header</div><divstyle="padding: 10px;"><divid="MessageBoxContent"class="dialog-content"> Hello Cruel World.</div><hr /><inputtype='button'id='MessageBoxOk'value='Ok' /><inputtype='button'id='Button1'value='Cancel' /></div></ww:wwModalDialog><scripttype="text/javascript"> $().ready( function() { showStatus({ autoClose: true }); $("#btnShowMsgBox").click(function () { MessageBox.show(); }); }); function onMessageBoxClick() { var button = $(this).val(); showStatus("You clicked: " + button,3000); if (button == "Ok") return true; // don't close return false; }</script>

+++ Rick ---


+++ Rick ---


dear Rick,
I am not able to make a dialog control, I followed your help (AJAX Controls - Modal Dialogs) to load a wwModalDialog control on the webpage:

<%@ PageLanguage="C#"ID="test_Page" GeneratedSourceFile="test_Page.prg" %><%@ Register Assembly="WebConnectionWebControls" Namespace="Westwind.WebConnection.WebControls" TagPrefix="ww" %><!DOCTYPE html><html><head><linkhref="westwind.css"rel="stylesheet"type="text/css" /><linkhref="StyleSheet.css"rel="stylesheet"type="text/css" /><ww:wwWebLiteralrunat="server" Visible="false"><scriptsrc="~/scripts/jquery.js"type="text/javascript"></script><scriptsrc="~/scripts/ww.jquery.js"type="text/javascript"></script></ww:wwWebLiteral></head><body><formid="form1"runat="server"><ww:wwModalDialogID="wwModalDialog1"runat="server"Style="background: white; display: none; width: 400px;"><divid="MessageBoxHeader"class="gridheader"> Header</div><divstyle="padding: 10px;"><divid="MessageBoxContent"></div><hr /><inputtype='button'id='MessageBoxOk'value='Close Dialog' /></div></ww:wwModalDialog><ww:wwWebButtonID="wwWebButton1"runat="server" Click="Test_click"Text="Test"width="80" /></form></body></html>

I would like to have a simple generic dialog, so I made a function

FUNCTION Test_click()this.wwModalDialog1.MessageBox("Html Text here<hr>More Text","Title","OK","Cancel",CallbackHandler)ENDFUNC

but I get the error: Variable "CallBackHandler" is not found.
If I remove CallbackHandler parameter then I get the error: Property Messagebox is not found.

You say in your help:
"If you don't want to design a dialog explicitly you can also create one on the fly with the static wwModalDialog.messageBox() function and the more flexible createDialog() methods."

Please how to have a generic modal dialog with OK and Cancel button, and how to get its return value?
Thank you very much



Rick Strahl
West Wind Technologies


from Maui, Hawaii

Making waves on the Web


Viewing all articles
Browse latest Browse all 10393

Trending Articles