John John
Posted on on Mar 1, 2010
Hi,
I have a problem in viewing text in the PDF file. I have 3 hyperlink controls as the following aspx code sicne my project scenario is like that. In viewing the text of the controls in Grid has no problem. But in PDF file the position and text has been changed.
Say in simple the above text are ok with grid displayed like Title1,Titll2,Title3
But in PDF file it seems like Title2,title3,Title1 respectively
I dont know what to do to come text as an expected manner
-Thanks
I have a problem in viewing text in the PDF file. I have 3 hyperlink controls as the following aspx code sicne my project scenario is like that. In viewing the text of the controls in Grid has no problem. But in PDF file the position and text has been changed.
<telerik:GridTemplateColumn HeaderText="URL" SortExpression="URL" DataField="URL" GroupByExpression="URL Group By URL" UniqueName="URL" HeaderStyle-Width="52%"> |
<ItemTemplate> |
<asp:HyperLink ID="URL" Text='Title1' runat="server"></asp:HyperLink> |
<asp:Literal ID="literalUrl1" Text='Title2' runat="server"></asp:Literal> |
<asp:Literal ID="literalUrl2" Text='Title3' runat="server"></asp:Literal> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
Say in simple the above text are ok with grid displayed like Title1,Titll2,Title3
But in PDF file it seems like Title2,title3,Title1 respectively
I dont know what to do to come text as an expected manner
-Thanks
10 Answers, 1 is accepted
0

John John
Top achievements
Rank 1
answered on 08 Mar 2010, 02:16 PM
Any suggessions?
0
Hello John,
I'm not sure how to reproduce this problem. Please download the attached demo and let me know if I'm missing something.
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I'm not sure how to reproduce this problem. Please download the attached demo and let me know if I'm missing something.
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

John John
Top achievements
Rank 1
answered on 17 Mar 2010, 03:20 PM
Hi,
Thanks for your reply, I used the ItemDatabound event to bind the above three link controls
But when i try to export the grid the i am not getting the exact text posotion from link controls. Still i am having the same issue.
-Thanks
Thanks for your reply, I used the ItemDatabound event to bind the above three link controls
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if ((e.Item.ItemType == GridItemType.AlternatingItem) || (e.Item.ItemType == GridItemType.Item)) |
{ |
HyperLink link1 = (HyperLink)e.Item.FindControl("URL"); // URL |
// Liternal Controls |
Literal literalUrl1 = (Literal)e.Item.FindControl("literalUrl1"); |
Literal literalUrl2 = (Literal)e.Item.FindControl("literalUrl2"); |
if (active) |
{ |
linkURL.Text = RowView.Row["URL"].ToString(); |
linkURLlinkURL.Text = linkURL.Text.Replace("/", "%2F"); |
linkURLlinkURL.Text = linkURL.Text.Replace("+", "%20"); |
linkURL.Target = "newwin"; |
linkURL.NavigateUrl = RowView.Row["URL"].ToString(); |
} |
else |
{ |
literalUrl1.Text = "<span class=\"inactive\">" + RowView.Row["URL"].ToString() + "</span>"; |
} |
literalUrl2.Text = "<br/><span style=\"font-size:8pt;\"> byte size: 21" ; |
literalUrl2.Text += ", last modified: " + String.Format("{0:M/d/yyyy}", RowView.Row["LastModified"]) + "</span>"; |
But when i try to export the grid the i am not getting the exact text posotion from link controls. Still i am having the same issue.
-Thanks
0

John John
Top achievements
Rank 1
answered on 18 Mar 2010, 03:47 PM
Hi,
Any ideas?
-Thanks
Any ideas?
-Thanks
0

John John
Top achievements
Rank 1
answered on 22 Mar 2010, 08:27 AM
Any suggessions?
0
John,
How do I reproduce this behavior? Can you modify my sample project or provide step-by-step instructions?
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
How do I reproduce this behavior? Can you modify my sample project or provide step-by-step instructions?
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

John John
Top achievements
Rank 1
answered on 23 Mar 2010, 12:02 PM
Hi,
Daniel for your reference i am giving some sample of code, by adding custom command template section for Export button
ASPX
CS
Hope it would be helpful to reproduce the behavior
-Thanks
Daniel for your reference i am giving some sample of code, by adding custom command template section for Export button
ASPX
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnItemDataBound="RadGrid1_ItemDataBound" |
OnNeedDataSource="RadGrid1_NeedDataSource" |
onitemcommand="RadGrid1_ItemCommand"> |
<ExportSettings IgnorePaging="True" OpenInNewWindow="True"> |
<Pdf AllowCopy="True" PageTitle="PostingNotice Billing Report" Keywords="None" Subject="RadGrid Export" |
Author="Anonymous" PageHeight="8.5in" PageWidth="14in" Title="PostingNotice Billing Report" /> |
</ExportSettings> |
<MasterTableView CommandItemDisplay="Top" GridLines="None"> |
<%--<CommandItemSettings ShowExportToPdfButton="true" />--%> |
<CommandItemTemplate> |
<table width="100%" class="RadCommandTable" style="padding: 0px;"> |
<tr> |
<td align="center"> |
<asp:Button ID="btnExport" CommandName="lnkExport" runat="server" Text="Export" /> |
</td> |
</tr> |
</table> |
</CommandItemTemplate> |
<Columns> |
<telerik:GridTemplateColumn HeaderText="URL" SortExpression="URL" DataField="URL" |
GroupByExpression="URL Group By URL" UniqueName="URL" HeaderStyle-Width="52%"> |
<ItemTemplate> |
<asp:HyperLink ID="URL" runat="server"></asp:HyperLink> |
<asp:Literal ID="literalUrl1" runat="server"></asp:Literal> |
<asp:Literal ID="literalUrl2" runat="server"></asp:Literal> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
</Columns> |
</MasterTableView> |
</telerik:RadGrid> |
CS
public DataTable GetData() |
{ |
DataTable dt = new DataTable(); |
DataColumn[] cols = new DataColumn[] { new DataColumn("URL"), new DataColumn("Active") }; |
dt.Columns.AddRange(cols); |
DataRow dr = dt.NewRow(); |
dr[0] = "http://www.test.com/docs/posters/test1.pdf"; |
dr[1] = "true"; |
dt.Rows.Add(dr); |
dr = dt.NewRow(); |
dr[0] = "http://www.test.com/docs/posters/test2.pdf"; |
dr[1] = "false"; |
dt.Rows.Add(dr); |
dr = dt.NewRow(); |
dr[0] = "http://www.test.com/docs/posters/test3.pdf"; |
dr[1] = "true"; |
dt.Rows.Add(dr); |
dr = dt.NewRow(); |
dr[0] = "http://www.test.com/docs/posters/test4.pdf"; |
dr[1] = "false"; |
dt.Rows.Add(dr); |
dr = dt.NewRow(); |
dr[0] = "http://www.test.com/docs/posters/test5.pdf"; |
dr[1] = "true"; |
dt.Rows.Add(dr); |
dr = dt.NewRow(); |
dr[0] = "http://www.test.com/docs/posters/test6.pdf"; |
dr[1] = "false"; |
dt.Rows.Add(dr); |
return dt; |
} |
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if ((e.Item.ItemType == GridItemType.AlternatingItem) || (e.Item.ItemType == GridItemType.Item)) |
{ |
//URL Binding |
HyperLink linkURL = (HyperLink)e.Item.FindControl("URL"); // URL |
// Liternal Controls |
Literal literalUrl1 = (Literal)e.Item.FindControl("literalUrl1"); |
Literal literalUrl2 = (Literal)e.Item.FindControl("literalUrl2"); |
GridDataItem DataItem = e.Item as GridDataItem; |
DataRowView RowView = e.Item.DataItem as DataRowView; |
Boolean active = Convert.ToBoolean(RowView.Row["Active"]); |
string fls = string.Empty; |
if (active) |
{ |
linkURL.Text = RowView.Row["URL"].ToString(); |
linkURLlinkURL.Text = linkURL.Text.Replace("/", "%2F"); |
linkURLlinkURL.Text = linkURL.Text.Replace("+", "%20"); |
linkURL.Target = "newwin"; |
linkURL.NavigateUrl = RowView.Row["URL"].ToString(); |
} |
else |
{ |
literalUrl1.Text = "<span class=\"inactive\"> No Records Available </span>"; |
} |
literalUrl2.Text = "<br/><span style=\"font-size:8pt;\"> byte size: "; |
literalUrl2.Text += ", last modified:</span>"; |
} |
} |
protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
{ |
this.RadGrid1.DataSource = GetData(); |
} |
protected void btnExport_Click(object sender, EventArgs e) |
{ |
//Setting the PDF flag to true |
ConfigurePDFExport(); |
RadGrid1.MasterTableView.ExportToPdf(); |
} |
//PDF Export configuration |
private void ConfigurePDFExport() |
{ |
//ExportPDF configuration settings |
RadGrid1.ExportSettings.FileName = "Testing"; |
RadGrid1.ExportSettings.Pdf.PaperSize = GridPaperSize.Legal; |
RadGrid1.ExportSettings.ExportOnlyData = true; |
RadGrid1.ExportSettings.IgnorePaging = true; |
RadGrid1.ExportSettings.OpenInNewWindow = true; |
RadGrid1.ExportSettings.Pdf.Title = "Billing Report"; |
RadGrid1.ExportSettings.Pdf.PageLeftMargin = Unit.Pixel(24); |
RadGrid1.ExportSettings.Pdf.PageRightMargin = Unit.Pixel(24); |
RadGrid1.ExportSettings.Pdf.PageBottomMargin = Unit.Pixel(24); |
RadGrid1.ExportSettings.Pdf.PageTopMargin = Unit.Pixel(55); |
} |
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.Item is GridCommandItem) |
{ |
//ExportPDF button clicks |
if (e.CommandName == "lnkExport") |
{ |
//Setting the PDF flag to true |
//isPrefillPDF = true; |
ConfigurePDFExport(); |
RadGrid1.MasterTableView.ExportToPdf(); |
} |
} |
} |
Hope it would be helpful to reproduce the behavior
-Thanks
0
Hello John,
You can sidestep this behavior if you set a default text to the controls in your item template:
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
You can sidestep this behavior if you set a default text to the controls in your item template:
<
telerik:GridTemplateColumn
HeaderText
=
"URL"
SortExpression
=
"URL"
DataField
=
"URL"
GroupByExpression
=
"URL Group By URL"
UniqueName
=
"URL"
HeaderStyle-Width
=
"52%"
>
<
ItemTemplate
>
<
asp:HyperLink
ID
=
"URL"
runat
=
"server"
Text
=
" "
></
asp:HyperLink
>
<
asp:Literal
ID
=
"literalUrl1"
runat
=
"server"
Text
=
" "
></
asp:Literal
>
<
asp:Literal
ID
=
"literalUrl2"
runat
=
"server"
Text
=
" "
></
asp:Literal
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

John John
Top achievements
Rank 1
answered on 29 Mar 2010, 12:45 PM
Hi Daniel,
Thanks for your response.Setting the default text on controls doesnt seem to solve my issue. I modified my ASPX code with the changes as u mentioned below. But still i am facing the same issue;
-Thanks
Thanks for your response.Setting the default text on controls doesnt seem to solve my issue. I modified my ASPX code with the changes as u mentioned below. But still i am facing the same issue;
-Thanks
0
Hello John,
I'm not sure as to why this happens in your scenario, but you can try to insert a table to hold your controls in place:
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I'm not sure as to why this happens in your scenario, but you can try to insert a table to hold your controls in place:
<
table
style
=
"width: 500px"
>
<
colgroup
>
<
col
/>
<
col
/>
<
col
/>
</
colgroup
>
<
tr
>
<
td
>
<
asp:HyperLink
ID
=
"URL"
runat
=
"server"
Text
=
" "
></
asp:HyperLink
>
</
td
>
<
td
>
<
asp:Literal
ID
=
"literalUrl1"
runat
=
"server"
Text
=
" "
></
asp:Literal
>
</
td
>
<
td
>
<
asp:Literal
ID
=
"literalUrl2"
runat
=
"server"
Text
=
" "
></
asp:Literal
>
</
td
>
</
tr
>
</
table
>
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.