i have 4 pages in aspx. page A, B , C, D. if i go from pageA to Page B then after clicking submit on PageB its should goto PageC and open Page D in a new window at same time. but if i go directly to PageBand click submit then it should only goto PageC and not open PageD in new window. i am using /?dest=pageD.aspx in querystring but it wo开发者_Go百科nt work. How can i acheive this?
Why use query string? Use PostBackUrl on the submit button. You can set it dynamically depending on the breadcrumb of your choice (ViewState/Session/Whatever), and then you'll still have access to controls via Page.PreviousPage.*. You could even use an injected javascript method to cause the current page to post back but to open a window in the background onclick.
You could even have the breadcrumb in the query string I guess.
if(Request.QueryString["PageVisit"] == "A") {
this.btnSubmit.PostBackUrl = "c.aspx";
this.btnSubmit.Attributes.Add("onclick","javascriptOpenWindowFunc();");
}
Its very easy.
After submitting from PageB, you should have a following javascript.
function SubmitContent()
{
document.forms[0].action = "PageC.aspx";
// then we need to open i new window of pageD.aspx;
window.open("PageD.aspx");
//now submitting our page.
document.forms[0].submit();
}
Raj
精彩评论