我曾經在一個網站上發佈過一個第三方網站,在客戶的網站上進行搜索。最後我做一個簡單的Response.Redirect並在搜索參數,通過查詢字符串,像這樣通過:
protected void Button1_Click(object sender, EventArgs e)
{
string SearchQueryStringParameters = @"?SearchParameters=";
string SearchURL = "Search.aspx" + SearchQueryStringParameters;
Response.Redirect(SearchURL);
}
而在你的頁面加載你的Search.aspx頁...
protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Request.QueryString["SearchParameters"]))
{
// prefill your search textbox
this.txtSearch.Text = Request.QueryString["SearchParameters"];
// run your code that does a search and fill your repeater/datagrid/whatever here
}
else
{
// do nothing but show the search page
}
}
希望這會有所幫助。
是的,但你的狀態,我的母版不與周圍的一切都包主服務器形式(因爲每一個其他頁面是一個普通的.net網絡表格) 感謝您的答案,但! – 2008-11-26 01:16:47
我通過在表單外部添加另一個佔位符,但在主內容div內部工作過幾次。取決於你的應用是如何佈局的,但有時候可能,如果你的導航依賴於表單內部的話,那麼probby不可能。 – seanb 2008-11-26 01:36:56