Tuesday, September 22, 2015

asp.net fire button click in javascript function

<asp:Button ID="btnSetRadEditorContent" runat="server" OnClick="btnSetRadEditorContent_Click" Style="display: none;" />


 function SetDocumentEditorSrc(WrkID) {
                __doPostBack('<%= btnSetRadEditorContent.UniqueID %>');
            }


  protected void btnSetRadEditorContent_Click(object sender, EventArgs e)
        {
            string filePath = Server.MapPath("~/SampleInitialContent.docx");
            byte[] fileBinaryData = File.ReadAllBytes(filePath);
            string convertedContent = Functions.ConvertDocxToHtml(fileBinaryData);

            RadEditor1.Content = convertedContent;
        }

No comments:

Post a Comment