如果你願意,你也可以用javascript來做到這一點。您可以直接在您的OK按鈕像這樣把它掛:
btnOk.Attributes.Add("onClick", "javascript:history.go(-2); return false;");
,或者你就可以在網頁上使用ClientScriptManager
(從MSDN)對其進行註冊:
// Define the name and type of the client scripts on the page.
String csname = "GoBackScript";
Type cstype = this.GetType();
// Get a ClientScriptManager reference from the Page class.
ClientScriptManager cs = Page.ClientScript;
// Check to see if the startup script is already registered.
if (!cs.IsStartupScriptRegistered(cstype, csname))
{
String scriptText= "<script type=\"text/javascript\">" +
"window.history.go(-2);</" + "script>";
cs.RegisterStartupScript(cstype , csname, scriptText);
}
你不想使用WizardControl? – Robert 2011-03-22 09:33:51
我想不使用嚮導的原因是因爲使用哪些頁面的動態特性。雖然我同意,但是一個好的設計可能會使用一個嚮導控件,它具有UserControls形狀的動態加載形式。 – 2011-03-22 09:40:42