开发者

C# back event in button

开发者 https://www.devze.com 2022-12-14 17:14 出处:网络
I\'m trying to cod开发者_开发知识库e a back event in C# into a button click event, but I cant find the right steps. I am using Visual Studio 2008.Use can use the

I'm trying to cod开发者_开发知识库e a back event in C# into a button click event, but I cant find the right steps. I am using Visual Studio 2008.


Use can use the

Page.PreviousPage

to get the page that transferred control to the current page.

When you use the Transfer method or use cross-page posting to transfer processing from one ASP.NET page to another, the originating page contains request information that might be required for the destination page. You can use the PreviousPage property to access that information

If the current page is being rendered as a result of a direct request (not a transfer or cross-post from another page), the PreviousPage property contains nullNothingnullptra null reference (Nothing in Visual Basic).


One approach that can be used is to use the javascript history method:

    protected void Button1_Click(object sender, EventArgs e)
    {
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "My Unique Key", "<script>history.go(-2)</script>");

    }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号