Hello all,
How do I deploy Telerk.web.UI.dll on a shared hosting server? The instruction manual says we need to create a virtual directory and upload the telerik dll. In this case, where do i refer this path my application?
thanks,
10 Answers, 1 is accepted
You can copy telerik’s dlls locally to your application in the \bin folder, and upload the whole application to common virtual directory on the server.
Paths in web.config must be relative and simple (without the Version, Culture and PublicKeyToken). Then make sure to add dlls from your \bin folder to the References of the web application.
Regards,
Vasil
the Telerik team

Hello Vasil,
I'm trying to implement RadRating in one of the webpage. I did tried as you suggested by adding and referring the dll from /bin folder. Still it is throwing up some error. It throws an javascript error ""Telerik" is undefined". For your reference I have pasted the javascript below.The error is pointed to the 3rd line starting with Telerik.Web.UI.Rating.....
*******************************************
<script type="text/javascript">
//<![CDATA[
Telerik.Web.UI.RadRating._preInitialize("ctl00_cphBody_rptResourceDetails_ctl00_radRating","0");Telerik.Web.UI.RadRating._preInitialize("ctl00_cphBody_radRatingCtrl","0");Sys.Application.initialize();
Sys.Application.add_init(function() {
$create(Telerik.Web.UI.RadRating, {"_preInitializeComplete":true,"_uniqueID":"ctl00$cphBody$rptResourceDetails$ctl00$radRating","clientStateFieldID":"ctl00_cphBody_rptResourceDetails_ctl00_radRating_ClientState","precision":2,"readOnly":true,"value":3.3}, null, null, $get("ctl00_cphBody_rptResourceDetails_ctl00_radRating"));
});
Sys.Application.add_init(function() {
$create(Telerik.Web.UI.RadRating, {"_autoPostBack":true,"_preInitializeComplete":true,"_uniqueID":"ctl00$cphBody$radRatingCtrl","clientStateFieldID":"ctl00_cphBody_radRatingCtrl_ClientState"}, null, null, $get("ctl00_cphBody_radRatingCtrl"));
});
//]]>
</script>
thanks,
Please confirm that you have proper httpHandlers in your web.config. Check this help topic for more information.
Regards,
Vasil
the Telerik team

thanks for pointing me in the right direction. I just noticed that the hosting web server runs in II7. I added the reference under <system.webServer> and it worked fine. thanks for the timely help.
thanks,
Norbert

I'm trying to do a pdf export using telerik:RadGrid. It works fine but it is not picking up the styles from css. Is there a way?
Also is there a way to use the PDF export without RadGrid / Editor?
thanks,
Norbert
If you want the grid to be styled when exported to pdf, you can use inline styles.
You can set them on ItemDataBound or ItemCreated events. Or on ExcelExportCellFormatting event, if the items are of type DataItem Also see this demo about exporting.
About your second question: You should be able to use the pdf export for other html content, instead of the grid itself. On PdfExporting event you can change the html of the grid (e.RawHTML). However this is not recommended, because it might not always work. In order to achieve your goal, you can use third party libraries like PDFsharp and FO.NET.
Kind regards,
Vasil
the Telerik team

I tried adding inline style to the page but still it is not working. I'm unable to send you the .aspx file since the attachments are restricted to images only. So i've copied the code below. I've commented in one of the line as "In-line style" for your understanding.
thanks,
Norbert
***************************************************************************************
<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" OnItemCreated="RadGrid1_ItemCreated"
AllowSorting="true" Skin="Black" Width="745px" AllowPaging="True" AutoGenerateColumns="False">
<ExportSettings IgnorePaging="true" OpenInNewWindow="true">
<Pdf PageHeight="297mm" PageWidth="210mm" PageTitle="Your Result" FontType="Subset" />
</ExportSettings>
<MasterTableView CommandItemDisplay="Top">
<CommandItemTemplate>
<asp:Button ID="btnDownloadPDF" runat="server" Width="100%" CssClass="pdfButton"
OnClick="btnDownloadPDF_Click" />
</CommandItemTemplate>
<Columns>
<telerik:GridTemplateColumn>
<ItemTemplate>
<div class="principle">
<div class="principle_resize">
<div class="principle_resize_top">
<div class="principle_resize_bottom">
<h3 style=" font:bold 14px Arial, Helvetica, sans-serif; color:#f1b607; padding:20px 20px 10px 20px; margin:0;"> <!--In-line style-->
<%#DataBinder.Eval(Container.DataItem, "PhaseId") + ". " + DataBinder.Eval(Container.DataItem, "PrincipleDesc") %></h3>
<div class="result">
<p style=" font:normal 12px Arial, Helvetica, sans-serif; color:#7d7d7d; line-height:1.8em; padding:3px 0 0 13px; margin:0;">
<b>Your result</b></p>
<img src='<%# "/images/bar_" + Eval("imgurl")%>' width="575" height="22" border="0"
alt="score" class="floatedbar" />
<asp:Repeater ID="rptChildCategory" runat="server" DataSource='<%# ((DataRowView)Container.DataItem)
.Row.GetChildRows("parentchildrelation") %>'>
<ItemTemplate>
<p>
<%# DataBinder.Eval(Container.DataItem, "[\"GradeShortDesc\"]")%></p>
<div class="report_resource_wrap">
<%# DataBinder.Eval(Container.DataItem, "[\"PrincipleId\"]")%>)
Read more & view recommended resources »
<div id='p<%# DataBinder.Eval(Container.DataItem, "[\"PrincipleId\"]")%>'>
<p>
<%# DataBinder.Eval(Container.DataItem, "[\"GradeLongDesc\"]")%><br />
<h3>
Your recommended Resources</h3>
<asp:Repeater ID="rptAddRes" runat="server" DataSource='<%# ((DataRow)Container.DataItem)
.GetChildRows("graderesourcerelation") %>'>
<ItemTemplate>
<div class="resource_box">
<img src='<%# "/images/reportimages/" + Eval("[\"principleid\"]") + "/" + Eval("[\"gradeid\"]")+ "/" + Eval("[\"contentid\"]") + "/" + Eval("[\"imagename\"]")%>' width="81" height="65" alt="Resource" border="0" />
<p>
<span class="yellow">
<%# DataBinder.Eval(Container.DataItem, "[\"ResourceTitle\"]")%></span><br />
<%# DataBinder.Eval(Container.DataItem, "[\"ResourceDesc\"]")%><br />
<%# DataBinder.Eval(Container.DataItem, "[\"resourcelink\"]")%>
<%# DataBinder.Eval(Container.DataItem, "[\"linktitle\"]")%>
»</p>
</div>
</ItemTemplate>
</asp:Repeater>
</p>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
</div>
</div>
</div>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<HeaderStyle Font-Names="Arial Unicode MS" Font-Size="16px" HorizontalAlign="Center" />
</MasterTableView>
</telerik:RadGrid>
Your code looks fine and it should work this way, there is probably some little mistake, but it is hard to debug non-runnable project.
Here is one simplified grid, on witch export work fine with styles.
.aspx:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
GridLines
=
"None"
Width
=
"745px"
AutoGenerateColumns
=
"False"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
>
<
ExportSettings
OpenInNewWindow
=
"true"
/>
<
MasterTableView
AutoGenerateColumns
=
"true"
CommandItemDisplay
=
"Top"
CommandItemSettings-ShowExportToPdfButton
=
"true"
>
<
Columns
>
<
telerik:GridTemplateColumn
>
<
ItemTemplate
>
<
h3
style="font: bold 14px Arial, Helvetica, sans-serif; color: #f1b607; padding: 20px 20px 10px 20px;
margin: 0;">
Some text
</
h3
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
>
<
ItemTemplate
>
<
h3
style="font: bold 10px Arial, Helvetica, sans-serif; color: #b607f1; padding: 20px 20px 10px 20px;
margin: 0;">
<%# strings[0] %>
</
h3
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
public
string
[] strings =
new
string
[] {
"string1"
,
"string2"
,
"string3"
};
protected
void
RadGrid1_NeedDataSource(
object
sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
RadGrid1.DataSource = strings;
}
Try it out and let me know how it works with you and what differs in your case.
Regards,
Vasil
the Telerik team

Thanks for sending me the sample code. It worked fine to an extent except that it is not taking the font (arial / verdana etc) and the alignment is not proper in the pdf when compared to web page. I have attached the screenshot of the webpage and pdf for you to view. Please let me know how to tackle the font and alignment issue meanwhile I will try to find the error in my inline style.
thanks,
norbert
If you want font Verdana for example, you can use this:
<
h3
style
=
"font-family:Verdana; font-style:normal; color: #b607f1;"
>
some text here
</
h3
>
Regarding the alignment, if you do not use auto generated columns (as in your original code), you will not have this problem. It is probably coming from the padding set in pixels, and the different DPI of the monitor and the pdf file.
Greetings,
Vasil
the Telerik team