Guys, some time we need to call some javascript function from code behind. It is very easy to do with the following one line of code.
It can alert a message you required. For example a validation message.
1. Showing an alert message from server side
ScriptManager.RegisterStartupScript( this, typeof(Page), "test","alert('" + message + "');",true);
2. Opening a .aspx page in new window from server side using javascript.
Example code:
string jScript = "window.open('../Report/" + reportFileName + "','_blank','height=655,width=810,top=150,left=150,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes,copyhistory=false')" ;
ScriptManager.RegisterStartupScript( this, typeof(Page), "Report",
No comments:
Post a Comment