To use javascript in aspx page for functions like window popup etc...
1)In aspx page html view write the necessary javascript:-
function OpenNew(message){ window.open("NewPage.aspx?" + message,"_blank"); }
2)In code behind write function to register page script ex.
protected void RegisterSubmitErrorScript(string Message) { string script = "< script language="'j a v a s c r i p t '">OpenNew('" + Message + "');"; Page.RegisterStartupScript("OpenNew",script);
}
3)Then anywhere in the page when u want to respond for new window to be open based on any condition being true or false call function above passing parameters if any ex.
RegisterSubmitErrorScript("param1=" + param);
Note:By changing javascript function "window.open" with any of other javascript functions,they can be performed.
No comments:
Post a Comment