मेरे पास एक वेबफॉर्म है जिस पर मैंने AJAX टूलकिट का HtmlEditorExtender1
उपयोग किया है। यह ठीक काम कर रहा है। अब मैं एक बटन क्लिक पर iTextSharp का उपयोग कर पूरे वेबफॉर्म को पीडीएफ में बदलने की कोशिश कर रहा हूं। लेकिन मैं इस त्रुटि हो रही है:विस्तारक नियंत्रण 'HtmlEditorExtender1' एक पंजीकृत विस्तारक नियंत्रण नहीं है
Extender control 'HtmlEditorExtender1' is not a registered extender control. Extender controls must be registered using RegisterExtenderControl() before calling RegisterScriptDescriptors().
Parameter name: extenderControl
मेरा मानना है कि इसके साथ HtmlEditorExtender1
<ajaxToolkit:HtmlEditorExtender ID="HtmlEditorExtender1" runat="server" TargetControlID="txtkeyresultforyear" EnableSanitization="false" />
मेरी वेबफ़ॉर्म के शीर्ष करने के लिए कुछ न कुछ है इस तरह दिखता है:
<%@ Page Title="" Language="C#" MasterPageFile="~/ModuleMain.master" AutoEventWireup="true"
ValidateRequest="false" CodeBehind="xyz.aspx.cs" EnableEventValidation = "false" Inherits="abc.xyz" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
यह बटन पर मेरा कोड क्लिक करें:
protected void btntopdf_Click(object sender, EventArgs e)
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
this.Page.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
}
संपादित करें:
मैं इस त्रुटि हो रही है:
this.Page.RenderControl(hw);
क्या आपके पास '<एएसपी: ScriptManager आईडी =" ScriptManager1 "runat =" सर्वर "> एएसपी: ScriptManager>' asp.net वेब के रूप में मास्टर पृष्ठ में –
@syedmhamudulhasanakash, हाँ। – Arbaaz
@syedmhamudulhasanakash मैंने अभी जांच की है .. मैं स्क्रिप्ट प्रबंधक को न तो मास्टर पेज पर और न ही बाल पृष्ठ पर नहीं ढूंढ सकता .. मैंने बच्चे पृष्ठ पर स्क्रिप्ट मैनेजर जोड़ने की कोशिश की लेकिन मुझे त्रुटि मिली कि स्क्रिप्टमैनगर का केवल एक उदाहरण जोड़ा जा सकता है। यह बहुत अजीब है। – Arbaaz