Re: Ptinter dialogue from serverside

  •  04-21-2010, 11:36 PM

    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
View Complete Thread