Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Javascript Modal Dialog To Holt App

Status
Not open for further replies.

apc2003

Programmer
Aug 29, 2003
54
0
0
GB
We need to show a dialog and stop execution of the C# code that follows the dialog until the dialog is closed. It needs to stop and wait just after the Page.Controls.Add line.

Bare in mind this is a Multi user application and using Thread.Sleep and code like this isn't an option.

The code is as follows...

Code:
if (currentBookedPlaces > maxPlacesNew)
{
string jStr = 
@"<script language='JavaScript'> 
    window.showModalDialog('Test.aspx',null,
      'dialogWidth=200px;dialogHeight=100px');
</script>";

LiteralControl lictl = new LiteralControl(jStr);
Page.Controls.Add(lictl);

//Need the code to holt execution here until the above
//dialog has been closed.
}

// Code continues here...
 
you cannot make serverside code wait for a clientside code event to take place.

this is because AFTER the serverside processing of the document is completed, the rendered page is sent to the browser!

the browser has no way of manipulating (such as pausing, resuming) server side execution of code!

you can however simulate this by ending execution after the script is being added to the controls collection and upon the closing of the dialog (using javascript of course) sumbit the page again and using the values from the dialog (passed to this document through hidden fields also using javascript), continue the processing by calling a procedure that should only execute after the dialog is closed.

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top