Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9168203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:34:30+00:00 2026-06-17T15:34:30+00:00

I have this problem with iTextsharp to isn’t rendering the following controllers asp:Literal &

  • 0

I have this problem with iTextsharp to isn’t rendering the following controllers asp:Literal & asp:DataList can someone help me to solve this problem
page markup:

   <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="pdfPrintPage.aspx.cs" EnableEventValidation="false" Inherits="Compudata_ProjectManager.pdfPrintPage" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style type="text/css">
            .style1
            {
                width: 100%;
            }
        </style>
    </head>
    <body>
         <form id="form1" runat="server">
     <asp:PlaceHolder ID="ph_pdfPrint" runat="server">
    <div>
            &nbsp;<table class="style1">
                <tr>
                    <td>
                        Task ID: #<asp:Label ID="lbl_taskID" runat="server" Text="Label"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        Created on:
                        <asp:Label ID="lbl_CreatedOn" runat="server" Text="Label"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        Defualt Tech:
                        <asp:Label ID="lbl_DefultTech" runat="server" Text="Label"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        Status:
                        <asp:Label ID="lbl_Status" runat="server" Text="Label"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        Priority:
                        <asp:Label ID="lbl_priorty" runat="server" Text="Label"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        Est. Time :
                        <asp:Label ID="lbl_estTime" runat="server" Text="Label"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        Assigned to :
                        <asp:ListBox ID="lb_AssignedTo" runat="server"></asp:ListBox>

                    </td>
                </tr>
                <tr>
                    <td>
                        Default Tech: <asp:Label ID="lbl_DefaultTech" runat="server" Text="Label"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        Description :
                    </td>
                </tr>
                            <tr>
                    <td>
                       <asp:Literal ID="lit_description" runat="server"></asp:Literal>
                    </td>
                </tr>
            </table>
        </div>
            <h4>Entry</h4>
        <asp:DataList ID="DataList1" runat="server" DataKeyField="billingID" 
            >
            <ItemTemplate>
                billingID:
                <asp:Label ID="billingIDLabel" runat="server" Text='<%# Eval("billingID") %>' />
                <br />
                User Name:
                <asp:Label ID="User_NameLabel" runat="server" 
                    Text='<%# Eval("[User Name]") %>' />
                <br />
                taskID:
                <asp:Label ID="taskIDLabel" runat="server" Text='<%# Eval("taskID") %>' />
                <br />
                actualTotalTime:
                <asp:Label ID="actualTotalTimeLabel" runat="server" 
                    Text='<%# Eval("actualTotalTime") %>' />
                <br />
                createdOn:
                <asp:Label ID="createdOnLabel" runat="server" Text='<%# Eval("createdOn") %>' />
                <br />
                billableTypeID:
                <asp:Label ID="billableTypeIDLabel" runat="server" 
                    Text='<%# Eval("billableTypeID") %>' />
                <br />
                billingNumber:
                <asp:Label ID="billingNumberLabel" runat="server" 
                    Text='<%# Eval("billingNumber") %>' />
                <br />
                summary:
                <asp:Label ID="summaryLabel" runat="server" Text='<%# Eval("summary") %>' />
                <br />
                isCompleted:
                <asp:Label ID="isCompletedLabel" runat="server" 
                    Text='<%# Eval("isCompleted") %>' />
                <br />
                note:
                <asp:Label ID="noteLabel" runat="server" Text='<%# Eval("note") %>' />
    <br />

                dateOfService:
                <asp:Label ID="dateOfServiceLabel" runat="server" 
                    Text='<%# Eval("dateOfService") %>' />
                <br />
                <br />

            </ItemTemplate>
        </asp:DataList>




          </asp:PlaceHolder>                 
    <asp:SqlDataSource ID="assignedToUserList" runat="server" ConnectionString="<%$ ConnectionStrings:Compudata_ProjectManagerConnection %>"
                            SelectCommand="GetAllAssignedUserToTask" SelectCommandType="StoredProcedure">
                            <SelectParameters>
                                <asp:QueryStringParameter Name="taskID" QueryStringField="taskID" Type="Int32" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                            <asp:SqlDataSource ID="SqlDS_TaskBilling" runat="server" SelectCommand="GetAllbillingsTimesForTask"
                SelectCommandType="StoredProcedure" 
            ConnectionString="<%$ ConnectionStrings:Compudata_ProjectManagerConnection %>">
            <SelectParameters>
                <asp:QueryStringParameter DbType="Int32" Name="TaskID" 
                    QueryStringField="taskID" />
            </SelectParameters>
        </asp:SqlDataSource>
        </form>

    </body>
    </html>

C# code 


 using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.IO;
    using iTextSharp.text;
    using iTextSharp.text.html.simpleparser;
    using iTextSharp.text.pdf;
    using System.Drawing;
    using Compudata_ProjectManager.CodeFile.BOL;

    namespace Compudata_ProjectManager
    {
        public partial class pdfPrintPage : System.Web.UI.Page
        {
           protected void Page_Load(object sender, EventArgs e)
            {
                int taskID = Convert.ToInt32(Request.QueryString["taskID"]);
                populatePage(taskID);

                bindListBox();
                bindDataList();
                System.Threading.Thread.Sleep(3000);
                PDF_Export();
            }

           private void bindDataList()
           {
               DataList1.DataSource = SqlDS_TaskBilling;
               DataList1.DataBind();
           }

           private void bindListBox()
           {
               lb_AssignedTo.DataSource = assignedToUserList;
               lb_AssignedTo.DataTextField = "UserName";
               lb_AssignedTo.DataValueField = "UserId";
               lb_AssignedTo.DataBind();
           }

            private void populatePage(int taskID )
            {
                Task task = Task.GetTaskDetail(taskID);
                lbl_taskID.Text = task.TaskID.ToString();
                lbl_CreatedOn.Text = task.CreatedOn.ToString();
                lbl_DefultTech.Text = task.DefaultTeck;
                lbl_Status.Text = task.Status.ToString();
                lbl_priorty.Text = task.Priority.ToString();
                lbl_estTime.Text = task.EstTime.ToString();
                lbl_DefaultTech.Text = task.DefaultTeck.ToString();
                lit_description.Text = task.Description.Replace("\r\n", "<br/>").ToString();
            }

            protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    string decodedText = HttpUtility.HtmlDecode(e.Row.Cells[4].Text);
                    e.Row.Cells[4].Text = decodedText;

                }
            }



            private void PDF_Export()
            {
                int taskID = Convert.ToInt32(Request.QueryString["taskID"]);
                Task task = Task.GetTaskDetail(taskID);
                //Set content type in response stream
                Response.ContentType = "application/pdf";
                Response.AddHeader("content-disposition", "attachment;filename=" + task.TasKName + ".pdf");
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                //Render PlaceHolder to temporary stream
                System.IO.StringWriter stringWrite = new StringWriter();
                System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
                ph_pdfPrint.RenderControl(htmlWrite);
                StringReader reader = new StringReader(stringWrite.ToString());
                //Create PDF document
                Document doc = new Document(PageSize.A4);
                HTMLWorker parser = new HTMLWorker(doc);
                PdfWriter.GetInstance(doc, Response.OutputStream);
                doc.Open();
                try
                {
                    ////Create a footer that will display page number
                    parser.Parse(reader);
                }
                catch (Exception ex)
                {
                    //Display parser errors in PDF.
                    //Parser errors will also be wisible in Debug.Output window in VS
                    Paragraph paragraph = new Paragraph("Error! " + ex.Message);
                    //paragraph.SetAlignment("center");
                    Chunk text = paragraph.Chunks[0] as Chunk;
                    doc.Add(paragraph);
                }
                finally
                {
                    doc.Close();
                    Response.Write(doc);
                }

            }

            public override void VerifyRenderingInServerForm(Control control)
            {
            }
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:34:31+00:00Added an answer on June 17, 2026 at 3:34 pm

    just find the answer. I have to add this 2 lines

        lit_description.RenderControl(htmlWrite);
        DataList1.RenderControl(htmlWrite); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this problem that I can ref a button for control it. I
I have this problem I can't figure out, I query the DB this way:
I have this problem and I can't seem to find on the Internet for
I have this problem, and I can't figure it out whats is wrong. I
I have this problem that I can't seem to find a solution for... I
i have this problem that i can't solve for days now...here is my code.
I have this problem: I want to generate a new source code file from
I have this problem: $id is id for each user $img = 'http://www.somesite.com/pictures/'; $no_img
I have this problem since I'm beginning in OOP programming I want to close
I have this problem when I run SAS 9.2 on the command line on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.