开发者

C# back event in button

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜