printer

Last post 04-26-2010, 12:05 PM by adel. 15 replies.
Sort Posts: Previous Next
  •  04-19-2010, 10:18 AM 60222

    printer

    hi
  •  04-19-2010, 11:29 AM 60224 in reply to 60222

    Re: Ptinter dialogue from serverside

  •  04-19-2010, 1:47 PM 60228 in reply to 60224

    Re: Ptinter dialogue from serverside

    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
  •  04-19-2010, 11:11 PM 60236 in reply to 60228

    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
  •  04-21-2010, 11:37 AM 60282 in reply to 60236

    Re: Ptinter dialogue

    Thanks, ken.
  •  04-21-2010, 1:32 PM 60284 in reply to 60282

    Re: Ptinter dialogue from serverside

  •  04-21-2010, 1:50 PM 60285 in reply to 60284

    Re: Ptinter dialogue from serverside

    ok

  •  04-21-2010, 1:57 PM 60287 in reply to 60285

    Re: Ptinter

    trrying it
  •  04-21-2010, 2:02 PM 60288 in reply to 60285

    Re: Ptinter dialogue from serverside

    adel:

    print is NOT part of these commands. How can we tie them together, print and server fucntion?

     
    1. function CuteEditor_OnCommand(editor,command,ui,value)   
    2.     {   
    3.         //handle the command by yourself   
    4.         if(command.toLowerCase()=="print")   
    5.         {   
    6.             var answer = confirm("Click OK to stop this command.")   
    7.             if (answer){   
    8.                 return true;   
    9.             }   
    10.             else{   
    11.                 return false;   
    12.             }   
    13.         }   
    14.     }  

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-21-2010, 2:15 PM 60289 in reply to 60288

    Re:

    ok
  •  04-21-2010, 2:17 PM 60290 in reply to 60289

    Re: Ptinter

     
    I am including this in the page load, when the image is clicked
  •  04-21-2010, 2:18 PM 60291 in reply to 60289

    Re: Ptinter dialogue from serverside

    You need to use Ajax to call the server side code from the client side.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-21-2010, 2:30 PM 60292 in reply to 60290

    Re: Ptinter

    Ok,
  •  04-21-2010, 11:36 PM 60296 in reply to 60292

    Re: Ptinter dialogue from serverside

    adel:
    Ok, let me summrize this again. I ALREADY have a custom button added, when teh button is clicked, a post back command is triggeered to the server and some code gets executed. This all WORKS fine. ALL I need help with is , when that code gets done, how can I open the print dialogue button?without clicking any other buttons or anyhting?
     
    hi adel,
     
    Try
     
    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"] = "test();CuteEditor_GetEditor(this).ExecCommand('Print')";   
    19.             tc.Control.Controls.Add(Image1);   
    20.             base.OnLoad(e);   
    21.         }   
    22.         base.OnLoad(e);   
    23.     }   
    24.   
    25.     protected void button1_Click(object sender, EventArgs e)   
    26.     {   
    27.         label1.Text = "server side click";   
    28.     }   
    29. </script>   
    30.   
    31. <body>   
    32.     <form id="form1" runat="server">   
    33.         <CE:Editor ID="Editor1" runat="server" TemplateItemList="insertcustombutonhere">   
    34.         </CE:Editor>   
    35.         <asp:Label ID="label1" runat="server"></asp:Label>   
    36.         <asp:Button ID="button1" runat="server" Style="visibility: hidden" OnClick="button1_Click" />   
    37.     </form>   
    38. </body>   
    39. </html>   
    40.   
    41. <script>   
    42. function test()   
    43. {   
    44. var button1=document.getElementById('<%= button1.ClientID %>');   
    45. button1.click();   
    46. }   
    47. </script>  
    Regards,
     
    ken
  •  04-25-2010, 4:20 PM 60384 in reply to 60296

    Re: Ptinter dialogue from serverside

    Thanks, ken. This works good on my local machine but it is giving the 'object refrence not set to an instance of an object' on the production server at the first line of this :
    base.OnLoad(e);
    This is where the ref object is failing.
     
    Any ideas would be greatly apperictaed
    Thanks
  •  04-26-2010, 12:05 PM 60409 in reply to 60384

    Re: Ptinter dialogue from serverside

    Thanks, ken. No need to work on this. I figured it out.
View as RSS news feed in XML