Back to page that called

0

Is there a way for me to make a code on a quit button that will return me to the page that called? Fixing the page does not give, because this page (queryprocess) is called from several others.

I did so and it is giving me error:

<span id="sair">
                    <asp:LinkButton ID="sairbutton" Text="[x] sair" runat="server" 
                    onclick="history.go(-1);" />
                </span>

Error:

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS1026: ) expected

Source Error:


Line 643:               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Line 644:               <span id="sair">
Line 645:                   <asp:LinkButton ID="sairbutton" Text="[x] sair" runat="server" 
Line 646:                   onclick="history.go(-1);" />
Line 647:               </span>

It says it's missing a ")", but where do I put it?

Does not rotate. It did not give more error, but it does not work. My script.

<script type="text/javascript">
        function voltarPagina() {
            history.go(-1);
        }
    </script>

My asp.net

<span id="sair">
                    <asp:LinkButton ID="sairbutton" Text="[x] sair" runat="server" 
                    OnClientClick="voltarPagina();" />
                </span>

No error, but no return to the page that called, continues on the same page.

    
asked by anonymous 25.11.2014 / 17:42

3 answers

2

You can make the call via javascript:

<input action="action" type="button" value="Sair" onclick="history.go(-1);" />

The function can also be used:

history.back()

If you want to call a LinkButton:

<asp:LinkButton ID="sairbutton" Text="[x] sair" runat="server" 
     OnClientClick="voltarPagina();" />

<script type="text/javascript">
function voltarPagina()
{
    history.go(-1);
}
</script>
    
25.11.2014 / 18:35
0

To include a response using C #, you can do this by using the

25.11.2014 / 19:28
0

I think the problem was in the LinkButton. I changed and it worked.

<a href='javascript:history.go(-1)'>Voltar a pagina Anterior</a>
    
25.11.2014 / 20:02