Redirect page after showing save message
On buttonSave click after saving the record successfully ,I want to show “Save successfu开发者_如何学JAVAlly “ message on a label on a page for few seconds and then reload the page. Thanks in Advance
How about a server-side literal control that contains the save message and some JavaScript to wait the allotted time and then redirect?
Alternatively, I would instead suggest that the redirect happen immediately and pass a message indicator to the resulting page to display the message. It seems to be the more standard approach. But, not knowing your setup, it's possible that it may not be acceptable for your needs.
Create a hidden label on the page with viewstate off.
<asp:Label runat="server" ID="lblOk" Text="Save successfully" BackColor="Blue" EnableViewState="false" Visible="false" />
When save is ok, fill make it show.
lblOk.Visible = True
At the same time add an http refresh to the page to make the page reload.
Response.AddHeader("Refresh", "5")
When your page refreshes, the control will be hidden again because it will reset back to invisible.
精彩评论