Re: Ptinter dialogue from serverside

  •  04-19-2010, 11:11 PM

    Re: Ptinter dialogue from serverside

    adel:
    Hello,
    Thanks for responding.  Here is teh code I used on the server side(code behind) to open up the print dialogue and it does not open it:
     
                         StringBuilder sb = new StringBuilder();
                        sb.Append("<script language='javascript'>");
                          sb.Append(" var editor1 = document.getElementById('" + Editor1.ClientID + "');");
                  
                       sb.Append(" editor1.ExecCommand('Print',false,'Print');");
                        sb.Append("</script>");
                          Page.RegisterStartupScript("zoom", sb.ToString());
     
    Can you please try it and let me know.
    Thanks a lot
     
    Hi adel,
     
    Please try this example
     
    1. <%@ Page Language="C#" %>   
    2.   
    3. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>   
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
    5. <html xmlns="http://www.w3.org/1999/xhtml">   
    6. <head runat="server">   
    7.     <title>Untitled Page</title>   
    8. </head>   
    9.   
    10. <script runat="server">   
    11.     protected override void OnLoad(EventArgs e)   
    12.     {   
    13.         CuteEditor.ToolControl tc = Editor1.ToolControls["insertcustombutonhere"];   
    14.         if (tc != null)   
    15.         {   
    16.             System.Web.UI.WebControls.Image Image1 = new System.Web.UI.WebControls.Image();   
    17.             Image1.ToolTip = "Print";   
    18.             Image1.Attributes["onclick"] = "CuteEditor_GetEditor(this).ExecCommand('Print')";   
    19.             tc.Control.Controls.Add(Image1);   
    20.             base.OnLoad(e);   
    21.         }   
    22.   
    23.     }   
    24. </script>   
    25.   
    26. <body>   
    27.     <form id="form1" runat="server">   
    28.         <CE:Editor ID="Editor1" runat="server" TemplateItemList="insertcustombutonhere">   
    29.         </CE:Editor>   
    30.     </form>   
    31. </body>   
    32. </html>  
    Regards,
     
    ken
View Complete Thread