G
GaryDean
I have a 1.1 control that I wrote that prints a DataGrid as a Crystal Report
and it works just fine. I now have enhaced it to 2.0 and the ability to
print a GridView. The gridview, however, doesn't print properly because the
gridview is handling escaped characgters differently. I placed a
SQLDataSource, a gridview, and a datagrid on a page and bound both grids to
the same datasource pointing to Northwind db.
The gridview shows the escaped characters properly in the web page but they
are not displayed properly in the generated Html (view source). As you can
see below the snippet from the Gridview shows the name containing
ö.....
<td>BERGS</td><td>Berglunds snabbköp</td><td>Christina Berglund</td>
The source below is from the datagrid and dispalys the escaped character as
it should be displayed....
<td>BERGS</td><td>Berglunds snabbköp</td><td>Christina Berglund</td>
When my print control digs the data out of the GridView it is getting the
ö instead of the O with the two little dots above it. So it prints it
wrong. The Gridviw is letting the web page ingterpret the escaped
characters whereas the datagrid apparently does the interpreting before
rendering.
Why this difference? If I'm going to have to do this conversion myself, is
there any docs on how it's done?
Thanks
Gary
The entire aspx page is pasted here...
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td style="width: 32px">
</td>
<td style="width: 599px">
<div style="overflow: auto; width: 869px; height:
244px">
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataKeyNames="CustomerID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="CustomerID"
HeaderText="CustomerID" ReadOnly="True" SortExpression="CustomerID" />
<asp:BoundField DataField="CompanyName"
HeaderText="CompanyName" SortExpression="CompanyName" />
<asp:BoundField DataField="ContactName"
HeaderText="ContactName" SortExpression="ContactName" />
<asp:BoundField DataField="ContactTitle"
HeaderText="ContactTitle" SortExpression="ContactTitle" />
<asp:BoundField DataField="Address"
HeaderText="Address" SortExpression="Address" />
<asp:BoundField DataField="City"
HeaderText="City" SortExpression="City" />
<asp:BoundField DataField="Region"
HeaderText="Region" SortExpression="Region" />
<asp:BoundField DataField="PostalCode"
HeaderText="PostalCode" SortExpression="PostalCode" />
<asp:BoundField DataField="Country"
HeaderText="Country" SortExpression="Country" />
<asp:BoundField DataField="Phone"
HeaderText="Phone" SortExpression="Phone" />
<asp:BoundField DataField="Fax"
HeaderText="Fax" SortExpression="Fax" />
</Columns>
</asp:GridView>
</div>
</td>
<td style="width: 126px">
</td>
</tr>
<tr>
<td style="width: 32px">
</td>
<td style="width: 599px">
</td>
<td style="width: 126px">
</td>
</tr>
<tr>
<td style="width: 32px">
</td>
<td style="width: 599px">
<div style="overflow: auto; width: 869px; height:
244px">
<aspataGrid ID="DataGrid1" runat="server"
DataSourceID="SqlDataSource1">
</aspataGrid></div>
</td>
<td style="width: 126px">
</td>
</tr>
<tr>
<td style="width: 32px">
</td>
<td style="width: 599px">
</td>
<td style="width: 126px">
</td>
</tr>
<tr>
<td style="width: 32px">
</td>
<td style="width: 599px">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT CustomerID, CompanyName,
ContactName, ContactTitle, Address, City, Region, PostalCode, Country,
Phone, Fax
FROM Customers">
</asp:SqlDataSource>
</td>
<td style="width: 126px">
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
and it works just fine. I now have enhaced it to 2.0 and the ability to
print a GridView. The gridview, however, doesn't print properly because the
gridview is handling escaped characgters differently. I placed a
SQLDataSource, a gridview, and a datagrid on a page and bound both grids to
the same datasource pointing to Northwind db.
The gridview shows the escaped characters properly in the web page but they
are not displayed properly in the generated Html (view source). As you can
see below the snippet from the Gridview shows the name containing
ö.....
<td>BERGS</td><td>Berglunds snabbköp</td><td>Christina Berglund</td>
The source below is from the datagrid and dispalys the escaped character as
it should be displayed....
<td>BERGS</td><td>Berglunds snabbköp</td><td>Christina Berglund</td>
When my print control digs the data out of the GridView it is getting the
ö instead of the O with the two little dots above it. So it prints it
wrong. The Gridviw is letting the web page ingterpret the escaped
characters whereas the datagrid apparently does the interpreting before
rendering.
Why this difference? If I'm going to have to do this conversion myself, is
there any docs on how it's done?
Thanks
Gary
The entire aspx page is pasted here...
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td style="width: 32px">
</td>
<td style="width: 599px">
<div style="overflow: auto; width: 869px; height:
244px">
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataKeyNames="CustomerID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="CustomerID"
HeaderText="CustomerID" ReadOnly="True" SortExpression="CustomerID" />
<asp:BoundField DataField="CompanyName"
HeaderText="CompanyName" SortExpression="CompanyName" />
<asp:BoundField DataField="ContactName"
HeaderText="ContactName" SortExpression="ContactName" />
<asp:BoundField DataField="ContactTitle"
HeaderText="ContactTitle" SortExpression="ContactTitle" />
<asp:BoundField DataField="Address"
HeaderText="Address" SortExpression="Address" />
<asp:BoundField DataField="City"
HeaderText="City" SortExpression="City" />
<asp:BoundField DataField="Region"
HeaderText="Region" SortExpression="Region" />
<asp:BoundField DataField="PostalCode"
HeaderText="PostalCode" SortExpression="PostalCode" />
<asp:BoundField DataField="Country"
HeaderText="Country" SortExpression="Country" />
<asp:BoundField DataField="Phone"
HeaderText="Phone" SortExpression="Phone" />
<asp:BoundField DataField="Fax"
HeaderText="Fax" SortExpression="Fax" />
</Columns>
</asp:GridView>
</div>
</td>
<td style="width: 126px">
</td>
</tr>
<tr>
<td style="width: 32px">
</td>
<td style="width: 599px">
</td>
<td style="width: 126px">
</td>
</tr>
<tr>
<td style="width: 32px">
</td>
<td style="width: 599px">
<div style="overflow: auto; width: 869px; height:
244px">
<aspataGrid ID="DataGrid1" runat="server"
DataSourceID="SqlDataSource1">
</aspataGrid></div>
</td>
<td style="width: 126px">
</td>
</tr>
<tr>
<td style="width: 32px">
</td>
<td style="width: 599px">
</td>
<td style="width: 126px">
</td>
</tr>
<tr>
<td style="width: 32px">
</td>
<td style="width: 599px">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT CustomerID, CompanyName,
ContactName, ContactTitle, Address, City, Region, PostalCode, Country,
Phone, Fax
FROM Customers">
</asp:SqlDataSource>
</td>
<td style="width: 126px">
</td>
</tr>
</table>
</div>
</form>
</body>
</html>