PDA

Click to See Complete Forum and Search --> : Button: Execute code behind code, then call javascript function.


Memnoch1207
Jan 12th, 2005, 02:31 PM
I generate a pop up window from a datagrid hyperlink to delete a record.
The user clicks Yes (to delete it) or No.
When the user clicks Yes, I need to run the code in the buttons click event, then call a javascript function that submits the "parent form" (the page with the datagrid on it). then closes the pop up window.

I tried doing it with the Attributes.Add but that doesn't work because it doesn't execute the code behind code first.

I know I can do it using "Page.RegisterStartupScript", but because of my departments standards, I am not allowed to do it that way.

So does anyone know how I can execute the code in the buttons click event first, then call the client-side javascript function that closes the window and refreshes the datagrid?

Magiaus
Jan 12th, 2005, 03:33 PM
Register a Startup Script in your popup button. have the start up script window.opener.whatever you can even do window.opener.__doPostBack('','') to refresh the page depending on your page.

and at the end window.close

Memnoch1207
Jan 12th, 2005, 08:19 PM
I can't use RegisterStartUp script, it violates my departments standards.
I don't have a popup button.

Magiaus
Jan 13th, 2005, 01:01 AM
I meant in the "Yes" Button. I don't think there is another way. Why aren't you allowed to use StartUp scripts? I mean why is your department against it? Well you could try Response.Write but it does the same thing more or less.