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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning values from a Popup (within server code) 1

Status
Not open for further replies.

skip2004

Programmer
Nov 9, 2004
37
GB
I have an asp.net web page which requires the user to capture some information. On pressing a button, some server side code (vb.net) is called to validate some of the entered data.

If the validation passes OK, I then need (or would like) to display a popup which the user then selects some values from drop down lists, etc. I then need the server side to continue from that point using the values selected in the popup to do some more processing (eg. sql inserts, etc).

I already have some attributes to add "onclick" events to buttons which calls "showModalDialog" that returns back values to my page. But I would like to call this modalDialog mid-way through some server side code, and then continue using the values that have been returned back.

eg.

private sub btnCheck....
ValidateData()

'Something to call the modalDialog and return values

UpdateDatabase()
end sub

Any help greatly appreciated!

Thanks,
skip
 
you could only simulate doing this since it's not possible.
server side processing always takes place before and independent of the client side processing. they cannot happen simoultaneously for the same document.

what you can do is to have part of your processing done, save the mid-values in a Session ariable, then end server processing and display the popup at client side. that popup, upon submission could use the mid-way computed values and finish the processing.

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
Thanks for your reply.

To confirm, you mean complete whatever server side code and then call the popup using,

Response.Write("<script language='javascript'>window.Open('Notes.aspx');</script>")

and continue the processing in that popup?

How would I then close the popup when it finishes it's server side code?

Many thanks for your help.
 
with
Response.Write("<script language='javascript'>window.opener.focus();window.opener=this; window.close();</script>")

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
After closing the pop-up, is there anyway to execute some server side code on the main screen? I need to refresh a datagrid to reflect any db updates...

Cheers.
 
I have been trying to figure out how to do this for a day and a half. I am using this to do save values on Webform1 and then show a modal dialog that uses the values from Webform1 for calculations:

'On WebForm1, I have a button named btn1

Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowSpargerParms.Click
'Save values on current form

'open modal dialog for processing
Response.Write("<script language='javascript'>showModalDialog('Modaldlg.aspx', null,'status:no;dialogWidth:350px;dialogHeight:400px;dialogHide:false;help:no;scroll:no');</script>")
End Sub

This has been a great help.
 
:)

--------------------------
"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