2013-05-16 35 views
2

提出我有一個asp.net按鈕頁面URL,獲取您的事件從

protected void myPreciousButton_Click(object sender, EventArgs e) 
{ 
    //My Logic is happening 
    Response.Redirect(What will go here ??); 
} 

用戶如何可以重定向到同一個頁面?

更新

原因,我這樣做是因爲我做了一些改動數據庫,並使用Asychronize回發,但它們是不可見的,除非GridView的我做一個頁面refersh。

我已經嘗試過

<asp:AsyncPostBackTrigger 

<asp:PostBackTrigger 

,但沒有收穫只有痛苦

+1

問題不是很清楚。如果這是一個普通的網頁,在觸發事件後,您不需要重定向,它將加載相同的頁面。 – Kaf

+0

我更新了我的問題Kaf – Mathematics

+0

謝謝。我想你現在已經得到了答案。祝你好運 ! – Kaf

回答

1

得到當前頁面的URL您可以使用

protected void myPreciousButton_Click(object sender, EventArgs e) 
{ 
    Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri); 
} 

如果你想刷新你的頁面;

Response.Redirect(Page.Request.Url.ToString(), true); 
1

可以使用

string Pageurl = HttpContext.Current.Request.Url.AbsoluteUri;