HighTechTalks DotNet Forums  

Popup dialog page

Dotnet Scripting microsoft.public.dotnet.scripting


Discuss Popup dialog page in the Dotnet Scripting forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Kiyomi
 
Posts: n/a

Default Popup dialog page - 01-03-2006 , 11:31 AM






Hello,



I have some codes under event ButtonSend_Click to check the user input
values. This check is complicated enough using different stored procedures.
Then according the result of the checks, I would like to display a popup
page in which the user can select "OK", "Cancel" etc.



Now I created a javascript function doDialog() in HTML page to open a popup
page. I would like to call this function from the code behind page. I
cannot use onclick event with ButtonSend because I have lots of checks to do
before calling doDialog() function and this function should be called only
under certain test results. Also, I have to carry as a parameter different
message texts depending on the test results to display on the popup page.



Thank you for your kind advice,



Kiyomi



Reply With Quote
  #2  
Old   
Rashad Rivera
 
Posts: n/a

Default Re: Popup dialog page - 01-09-2006 , 01:54 AM






Kiyomi,



I don't quite understand your question, but if you want to display a
modal dialog to the client (triggered from the server-side code), then the
best way to go about this is to create a simple JavaScript function on a
global JS file that all your forms include. Then call this function form
your server side and pass in the crucial parameters like URL to the dialog
form, width, and height. Sample code below and I hope this helps.


- Rashad Rivera <spam (AT) omegusprime (DOT) com>
www.omegusprime.com


=====
myForm.cs code

....
private void Page_Load(object sender, System.EventArgs e) {

...

if (isTimeToShowDialog) {
this.RegisterStartupScript("someUniqueName",
"myJSDialogMethod('/theDialogForm.aspx', 450, 300);");
}
...
}


=========
client side: global.js
....
function myJSDialogMethod(url, width, height) {
return
window.showModelessDialog(url,null,'dialogHeight:' +height+'px;dialogWidth:'+width+'px;edge:Raised;ce nter:Yes;help:No;resizable:No;status:No;');
}

"Kiyomi" <k.kanaoka (AT) unesco (DOT) org> wrote

Quote:
Hello,



I have some codes under event ButtonSend_Click to check the user input
values. This check is complicated enough using different stored
procedures.
Then according the result of the checks, I would like to display a popup
page in which the user can select "OK", "Cancel" etc.



Now I created a javascript function doDialog() in HTML page to open a
popup
page. I would like to call this function from the code behind page. I
cannot use onclick event with ButtonSend because I have lots of checks to
do
before calling doDialog() function and this function should be called only
under certain test results. Also, I have to carry as a parameter
different
message texts depending on the test results to display on the popup page.



Thank you for your kind advice,



Kiyomi





Reply With Quote
  #3  
Old   
Kiyomi
 
Posts: n/a

Default Re: Popup dialog page - 01-09-2006 , 04:18 AM



Thank you for your kind advice.
I managed to make my popup work, using RegisterStartupScript as follows.
Now, I wish to retrieve user's response (OK or Cancel) and depending on
the response, I wish to continue different processes. Would you please
advice me how I can do this ?

Thank you very much.


My HTML page

function doConfirm(msg) {
var x=showModalDialog('Confirm.htm', msg, 'status:no;resizable:yes');
}


My VB code behind page

Function CheckRules()

Dim msg as String
msg = “An error is detected. Do you want to continue processing ? “

If (Not Me.IsStartupScriptRegistered("Startup")) Then
Me.RegisterStartupScript("Startup", "<script>doConfirm('" & msg &
"');</script>")
End If

----- After running doConfirm(msg) This is what I wish to do --------

If doConfirm(msg) returns True (i.e., user clicks OK button)
Continue processing below
Else (i.e., user clicks Cancel button)
Return False
Exit Function
End if

----- Continue processing

Return True

End Function




*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.