Ramzan Sadiq

Hello Asp.net Guru's:

I want to fire Page_unload Event on a button click.so it goes to the previous page.what Arguments i give for "Sender" and "e". why i can not use 'Me.cmdClose_Click' on page_unload

I appreciate your response



Re: JScript for the .NET Framework Fire Page_Unload Event on a Button Click

troy2

Remember that in ASP .NET you are dealing with two computers. The Server and the Client. The client is a web browser and the server is an Internet ASP server such as IIS. When events on the server are all all done, the user has not seen anything yet including buttons.

It is very important to remember that the events on the Server-side, such as "Page_Load" and "Page_Unload" happen before the users sees the page at all. That means that doing something when the user clicks a button would happen after the Page_Unload on the server has allready happened.

Even though you haven't yet explained what you are trying to do, I believe that what you may need is to use JavaScript on the client side in order to program the "onclick" event of a button there. If you do that you could do something like this:


<input type="button" value="Back" onclick="goBackToPreviousPage()">

<script>
function goBackToPreviousPage () {
history.back();
}
</script>





Re: JScript for the .NET Framework Fire Page_Unload Event on a Button Click

Ramzan Sadiq

Thank u very much for telling the concepts as well as the code.

I appreciate ur response

Ramzan