Hello,
I have problem in converting the following datalist to PDF. Can anyone help me in this regard.
Thanks,
Rohith

<asp:DataList ID="resultdatalist" runat="server">
            <ItemTemplate>
            
            <table id="listdata"   bordercolor="#000033" cellspacing="1" cellpadding="1" align="center"  border="2" width="610px" style="position:absolute;top:130px" >
<tr>
    <td style="width:260px; height:27px">
    <asp:Label ID="propertyname" runat="server" Text="1.PROPERTY NAME" Font-Bold="true" Font-Size="Small"></asp:Label></td><td style="width:350px"><asp:Label ID="propertynametxt"
        runat="server" Text='<%# Bind("PROPNAME")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="resourcename" runat="server" Text="2.RESOURCE NAME" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="resourcenametxt"
        runat="server" Text='<%# Bind("RESNAME")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="city" runat="server" Text="3.CITY" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="citytxt"
        runat="server" Text='<%# Bind("CITY")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="address" runat="server" Text="4.ADDRESS" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="addresstxt"
        runat="server" Text='<%# Bind("ADDRESS")%>' ></asp:Label>
</td>
</tr>


<tr>
    <td>
    <asp:Label ID="preparername" runat="server" Text="5.PREPARER NAME" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="preparenametxt"
        runat="server" Text='<%# Bind("NAME_PREP")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="county" runat="server" Text="6.COUNTY" Font-Bold="true" Font-Size="Small"></asp:Label></td><td>
    <asp:Label ID="countytxt"
        runat="server" Text='<%# Bind("COUNTYCD")%>' ></asp:Label>   
        
</td>
</tr>

<tr>
    <td>
    <asp:Label ID="style" runat="server" Text="7.STYLE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td>
       <asp:Label ID="styletxt"
        runat="server" Text='<%# Bind("ARCH_STYLE")%>' ></asp:Label> 
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="architect" runat="server" Text="8.ARCHITECT" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="architecttxt"
        runat="server" Text='<%# Bind("ARCH_BUILD")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="vicinity" runat="server" Text="9.VICINITY" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="vicinitytxt"
        runat="server" Text='<%# Bind("VICINTIY")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="lot" runat="server" Text="10.LOT" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="lottxt"
        runat="server" Text='<%# Bind("LOT")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="block" runat="server" Text="11.BLOCK" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="blocktxt"
        runat="server" Text='<%# Bind("BLOCK")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="platname" runat="server" Text="12.PLAT NAME" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="platnametxt"
        runat="server" Text='<%# Bind("PLATNAME")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="section" runat="server" Text="13.SECTION" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="sectiontxt"
        runat="server" Text='<%# Bind("SECTION")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="township" runat="server" Text="14.TOWNSHIP" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="townshiptxt"
        runat="server" Text='<%# Bind("TOWNSHIP")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="range" runat="server" Text="15.RANGE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="rangetxt"
        runat="server" Text='<%# Bind("RANGE")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="latitude" runat="server" Text="16.LATITUDE (North)" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="latitudetxt"
        runat="server" Text='<%# Bind("Lat")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="longitude" runat="server" Text="17.LONGITUDE (West)" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="longitudetxt"
        runat="server" Text='<%# Bind("Long")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="utm" runat="server" Text="18.UTM ZONE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="utmtxt"
        runat="server" Text='<%# Bind("UTM_Zone")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="northings" runat="server" Text="19.NORTHINGS" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="norhtingstxt"
        runat="server" Text='<%# Bind("Easting")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="eastings" runat="server" Text="20.EASTINGS" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="eastingstxt"
        runat="server" Text='<%# Bind("Northing")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="resource" runat="server" Text="21.RESOURCE TYPE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="resourcetxt"
        runat="server" Text='<%# Bind("RESTYPE")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="historic" runat="server" Text="22.HISTORIC FUNCTION" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="historictxt"
        runat="server" Text='<%# Bind("HIST_FUNC")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="current" runat="server" Text="23.CURRENT FUNCTION" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="currenttxt"
        runat="server" Text='<%# Bind("CURR_FUNC")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="area" runat="server" Text="24.AREA OF SIGNIFICANCE, PRIMARY" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="areatxt"
        runat="server" Text='<%# Bind("AREASG_1")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="second" runat="server" Text="25.AREA OF SIGNIFICANCE, SECONDARY" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="secondtxt"
        runat="server" Text='<%# Bind("AREASG_2")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="significance" runat="server" Text="26.DESCRIPTION OF SIGNIFICANCE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="significancetxt"
        runat="server" Text='<%# Bind("desc_seg")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="document" runat="server" Text="27.DOCUMENT RESOURCE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="documenttxt"
        runat="server" Text='<%# Bind("DOC_SOURCE")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="survey" runat="server" Text="28.SURVEY PROJECT" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="surveytxt"
        runat="server" Text='<%# Bind("SURVEY_PRO")%>' ></asp:Label>&nbsp; &nbsp; &nbsp; &nbsp;

    <asp:Label ID="projectname" runat="server" Text="PROJECT NAME" Font-Bold="true" Font-Size="Small"></asp:Label>:&nbsp; &nbsp; <asp:Label ID="projectnametxt"
        runat="server" Text='<%# Bind("Projectname")%>' ></asp:Label>

</td>
</tr>
<tr>
    <td>
    <asp:Label ID="dateofprep" runat="server" Text="29.DATE OF PREPARATION" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="datepreptxt"
        runat="server" Text='<%# Bind("DATE_PREP")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="photos" runat="server" Text="30.PHOTOGRAPHS" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="phototxt"
        runat="server" Text='<%# Bind("PHOTOGRAPH")%>' ></asp:Label>&nbsp; &nbsp; &nbsp; &nbsp;

    <asp:Label ID="yearpt" runat="server" Text="31.YEAR " Font-Bold="true" Font-Size="Small"></asp:Label>:&nbsp; &nbsp;<asp:Label ID="yearptttxt"
        runat="server" Text='<%# Bind("YEAR")%>' ></asp:Label>
</td>
</tr>

<tr>
    <td>
    <asp:Label ID="original" runat="server" Text="32.ORIGINAL SITE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="originaltxt"
        runat="server" Text='<%# Bind("ORIG_SITE")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="fromwhere" runat="server" Text="33.FROM WHERE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="fromwhwretxt"
        runat="server" Text='<%# Bind("FROMWHERE")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="accessible" runat="server" Text="34.ACCESSIBLE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="accessibletxt"
        runat="server" Text='<%# Bind("ACCESSIBLE")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="otherarch" runat="server" Text="35.OTHER ARCHTECTURAL STYLE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="otherarctxt"
        runat="server" Text='<%# Bind("OTHER_ARCH")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="foundation" runat="server" Text="36.FOUNDATION MATERIAL" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="foundationtxt"
        runat="server" Text='<%# Bind("FOUN_MAT")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="roof" runat="server" Text="37.ROOF TYPE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="rooftxt"
        runat="server" Text='<%# Bind("ROOF_TYPE")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="roofmat" runat="server" Text="38.ROOF MATERIAL" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="roofmattxt"
        runat="server" Text='<%# Bind("ROOF_MAT")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="walmat" runat="server" Text="39.WALL MATERIAL (PRIMARY)" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="walmattxt"
        runat="server" Text='<%# Bind("WALL_MAT_1")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="walsec" runat="server" Text="40.WALL MATERIAL (SECONDARY)" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="walsectxt"
        runat="server" Text='<%# Bind("WALL_MAT_2")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="windowtyp" runat="server" Text="41.WINDOW TYPE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="windowtyptxt"
        runat="server" Text='<%# Bind("WINDOW_TYP")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="windowmat" runat="server" Text="42.WINDOW MATERIAL" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="windowmattxt"
        runat="server" Text='<%# Bind("WINDOW_MAT")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="doortyp" runat="server" Text="43.DOOR TYPE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="doortyptxt"
        runat="server" Text='<%# Bind("DOOR_TYP")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="doormat" runat="server" Text="44.DOOR MATERIAL" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="doormattxt"
        runat="server" Text='<%# Bind("DOOR_MAT")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="extfea" runat="server" Text="45.EXTERIOR FEATURES" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="extfeatxt"
        runat="server" Text='<%# Bind("EXTER_FEA")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="intfea" runat="server" Text="46.INTERIOR FEATURES" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="intfeatxt"
        runat="server" Text='<%# Bind("INTER_FEA")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="decorative" runat="server" Text="47.DECORATIVE DETAILS" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="decorativetxt"
        runat="server" Text='<%# Bind("DEC_DETAIL")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="condiotionres" runat="server" Text="48.CONDITION OF RESOURCE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="conditionrestxt"
        runat="server" Text='<%# Bind("CONDITION")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="descres" runat="server" Text="49.DESCRIPTION OF RESOURCE" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="desrestxt"
        runat="server" Text='<%# Bind("DES_RES")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="comments" runat="server" Text="50.COMMENTS" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="commentstxt"
        runat="server" Text='<%# Bind("COMMENTS")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="placement" runat="server" Text="51.PLACEMENT" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="placementtxt"
        runat="server" Text='<%# Bind("PLACEMENT")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="liston" runat="server" Text="52.LISTED ON NATIONAL REGISTER" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="listontxt"
        runat="server" Text='<%# Bind("lonr")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="continue" runat="server" Text="CONTINUATION" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="continuetxt"
        runat="server" Text='<%# Bind("CONTINUATION")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="nationalreg" runat="server" Text="53.NATIONAL REGISTER ENTRY" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="nationalregtxt"
        runat="server" Text='<%# Bind("NRData")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="dateup" runat="server" Text="54.DATE UPDATED (mm/dd/yyyy)" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="dateuptxt"
        runat="server" Text='<%# Bind("Date_Updated")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="yearbuilt" runat="server" Text="55.YEAR BUILT" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="yearbuilttxt"
        runat="server" Text='<%# Bind("YEAR_BUILD")%>' ></asp:Label>
</td>
</tr>
<tr>
    <td>
    <asp:Label ID="yearclosed" runat="server" Text="56.YEAR CLOSED" Font-Bold="true" Font-Size="Small"></asp:Label></td><td><asp:Label ID="yearclosedtxt"
        runat="server" Text='<%# Bind("Year_Closed")%>' ></asp:Label>
</td>
</tr>
</table>
           </ItemTemplate>
            </asp:DataList>

Code Behind

protected void load()
    {
        int value = Convert.ToInt32(Request.QueryString["id"]);
        SqlConnection connection = new SqlConnection();
        connection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SHPO"].ConnectionString;
        SqlCommand cmd = new SqlCommand("select * from oli.dbo.hpr where OBJECTID='" + value + "'", connection);
        connection.Open();
        resultdatalist.DataSource = cmd.ExecuteReader();
        resultdatalist.DataBind();
        connection.Close();
    }

Recommended Answers

All 5 Replies

Can you suggest any way to use code rather than tools??

Can you suggest any way to use code rather than tools??

Take a look at this thread.

I am still getting problem. It says the type or namespace PdfConverter could not be found. Can you suggest best way to export datalist to pdf.

I followed the thread but i could only print heading of the page, the actual content is not exported to pdf.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.