G
Guest
I'm new to ASP .NET and have run into a problem. I have a child page open in
a web application that the user adds information to and then clicks the save
button. The information is added to a databse. If there is a problem with
adding the record to the database, I want to display the error message on the
page after post back from clicking the save button. If there are no errors I
want the child window to close after the post back.
I figured that if there were no errors I would create a javascript that
would run at page load to immediately close the window. Something similar to
adding <body onload = "window.close();">. I'm having trouble figuring out how
to add this javascript to the body element. I've added javascript before with
RegisterClientScriptBlock(), but that doesn't seem appropriate here. How
would I handle this or is there a better approach to having the window close?
a web application that the user adds information to and then clicks the save
button. The information is added to a databse. If there is a problem with
adding the record to the database, I want to display the error message on the
page after post back from clicking the save button. If there are no errors I
want the child window to close after the post back.
I figured that if there were no errors I would create a javascript that
would run at page load to immediately close the window. Something similar to
adding <body onload = "window.close();">. I'm having trouble figuring out how
to add this javascript to the body element. I've added javascript before with
RegisterClientScriptBlock(), but that doesn't seem appropriate here. How
would I handle this or is there a better approach to having the window close?