Call Javascript from c# code.
here PrintTree() is a javascript method.
For Post Back Button Event :
ScriptManager.RegisterStartupScript(btnViewGraph, btnViewGraph.GetType(), "addScript", "PrintTree();", true);
For Async Post Back Button Event
public void showReportAjax(string pageUrl, string param, Type cType, Page oPage, Control ctrl)
{
ScriptManager.RegisterStartupScript(ctrl, typeof(string), "redirect", "window.open('" + pageUrl + param + "');", true);
}
public static void ShowMessage(string msg)
{
Page page = HttpContext.Current.Handler as Page;
msg = msg.Replace("\r\n", "
");
msg = msg.Replace("'", "");
ScriptManager.RegisterStartupScript(page, page.GetType(), "msgs", "ShowMessage('" + msg + "');", true);
}