Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
232 views
I've got a problem when I have a large image in the content of my RadEditor, it seems to ignore my height or width settings (depending on where its viewed)

I did a simple test with the RadEditor set as:

<telerik:RadEditor ID="radEmailContent" runat="server" Width="500px" Height="500px" />


Then, in my code-behind, I set the content to:

radEmailContent.Content = "<p>This is a giraffe:</p><img src=""http://kitundu.files.wordpress.com/2012/02/giraffe-snack.jpg"" alt=""giraffe"" /><p>Cool, huh?</p>"


Doing this on a PC, it works the way I'd expect (see attached giraffeiframepc.jpg).  However, on an iPad, the image runs off the bottom, covering the buttons (giraffeiframeipad.jpg).  Looking around, I heard people say that iPads have an issue with Rich Text Editors and iFrames, so I tried adding the "ContentAreaMode="Div"" parameter.  But when I do that, the image runs off to the right (giraffediv.jpg).  I also tried setting the EditorCssFile to an empty .css file in case it was pulling in a strange style from somewhere else. 

Is this a known bug?  Am I doing something wrong?  Help, please!

 - Tim


Vessy
Telerik team
 answered on 29 May 2013
5 answers
130 views
Hi all,

i have a big issue, im using globalisation to make translation of the site in some languages but every time i have controls like radtextbox, anda radbuttons my aplication crashes when in some languages resource files, if i remove the telerik object it works fine.
Any solutions or similar problem or a cure for this.

best regards
Carlos
Top achievements
Rank 1
 answered on 29 May 2013
1 answer
319 views

How can I find the row index for a Rad grid? I want to pass the row index and 'this' to a javascript function to toggle the checkboxes on my rad grid from telerik.

Something like this: onClick="Checkbox(this, rowindex);"

Shinu
Top achievements
Rank 2
 answered on 29 May 2013
1 answer
201 views
Could we change RadDropDownList displaying style to MS style? How to do that?
Shinu
Top achievements
Rank 2
 answered on 29 May 2013
1 answer
112 views
Hi everybody,
I have a problem when use javascript. I used:   sender.get_masterTableView().fireCommand("Page", "First") in my code. It work in Firefox or google chorme, but it is not work in internet explore. This is error out of stack space int IE. Have any ideas?
Thanks you very much!
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
 
    function rowSelected(sender, args) {           
         if(args.get_commandName() == "SelectCommand")
    {
        var itemIndexHierarhical = +args.get_commandArgument();       
        var item = args.get_tableView().get_dataItems()[itemIndexHierarhical];
        var name = item.getDataKeyValue("MA_DV");
        Service_Test.Web_TITLE_CHITIET(name);            
    }     
    <%Session["CHILD_MADVIQLY"] = "OK";%>     
    sender.get_masterTableView().fireCommand("Page", "First");
    return false;
    }    
 
      
</script>
</telerik:RadCodeBlock>
<div style="width: 100%; height: 100% ; ">
    <table style="width: 100%; height: 100% ; ">
        <tr style="width: 100%; height: 100%">
            <td style="width:100%; height: 100%">
                <telerik:RadGrid ID="rgdBieu2" runat="server" GridLines="None"  OnCustomAggregate="rgdBieu2_CustomAggregate"
                    AutoGenerateColumns="False" ShowFooter="false" OnItemDataBound="RadGrid2_ItemDataBound"
                    AllowMultiRowSelection="True" Skin="Windows7"
                    onitemcommand="rgdBieu2_ItemCommand" >
                    <MasterTableView DataKeyNames = "HIEN_THI,NONGLAM,TEN_DV,CONGNGH,THUONGNGH,TIEUDUNG,KHAC,CKY,TCONG" NoMasterRecordsText="Không có dữ liệu" AutoGenerateColumns="False"  ClientDataKeyNames="MA_DV" Height="10px" Width="100%" EnableNoRecordsTemplate="true" >
                   
                  <SortExpressions>
                   <telerik:GridSortExpression FieldName="NewOrder" SortOrder="Ascending"/>
                    
                  </SortExpressions>
                     <NoRecordsTemplate>
                                Không có dữ liệu
                    </NoRecordsTemplate>
                     
                    <RowIndicatorColumn Visible="True">
                </RowIndicatorColumn>
                     <Columns>
                            <telerik:GridBoundColumn   HeaderText="Mã đơn vị" DataField="MA_DV" UniqueName="MA_DV" FooterText="Tổng" Visible="false"
                                HeaderStyle-Width="12%">
                                 
                                <HeaderStyle Width="12%" HorizontalAlign="Center" Font-Bold="True"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center"  />
                                  <FooterStyle HorizontalAlign="Center" Font-Bold="true"/>
                            </telerik:GridBoundColumn>                        
                            <telerik:GridBoundColumn Visible="false" HeaderText=" " DataField = "TEN_DV">
                                <HeaderStyle  HorizontalAlign="left" Font-Bold="True"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Left"  />
                            </telerik:GridBoundColumn>  
                                
                           <telerik:GridButtonColumn HeaderText="Tên đơn vị" DataTextField = "TEN_DV" UniqueName="TEN_DV" Visible="false"
                                CommandName="SelectCommand">
                                <HeaderStyle HorizontalAlign="Center" Font-Bold="True"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Left"  />
                               
                            </telerik:GridButtonColumn>
                            <telerik:GridBoundColumn Visible="false" HeaderText="Tên đơn vị" DataField = "BUTTON">
                                <HeaderStyle  HorizontalAlign="left" Font-Bold="True"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Left"  />
                            </telerik:GridBoundColumn>  
                            <telerik:GridButtonColumn HeaderText="Tên đơn vị" DataTextField = "BUTTON" UniqueName="HIEN_THI" FooterText="Tổng"
                                CommandName="SelectCommand">
                                <HeaderStyle HorizontalAlign="Center" Font-Bold="True"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Left"  />
                            <FooterStyle HorizontalAlign="left" Font-Bold="true"/>
                            </telerik:GridButtonColumn>
                              <telerik:GridBoundColumn Visible="true" HeaderText="" DataField = "HIEN_THI" UniqueName="HIEN_THI">
                                <HeaderStyle  HorizontalAlign="left" Font-Bold="True"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Left"  />
                            </telerik:GridBoundColumn>  
                             
                    
                        </Columns>
                    </MasterTableView>
                    <ClientSettings  AllowColumnsReorder="false" ReorderColumnsOnClient="true" EnableRowHoverStyle="true" EnablePostBackOnRowClick="false">
                        <Selecting AllowRowSelect="false" />
                        <Scrolling AllowScroll="false" UseStaticHeaders="true" />
                       <ClientEvents OnCommand="rowSelected" />
                    </ClientSettings>
                    <GroupingSettings ShowUnGroupButton="false" />
                </telerik:RadGrid>
            </td>
        </tr>       
    </table>
</div>

Kostadin
Telerik team
 answered on 29 May 2013
1 answer
101 views
Hi,

How to prepend a text before the RibbonBarNumericTextBox content from client side?

Thanks
Ben
Shinu
Top achievements
Rank 2
 answered on 29 May 2013
10 answers
636 views
Hi,

I'm facing problem with rad grid pdf export where after exporting to pdf, data is completely misaligned. Not sure if the table format I'm using inside the item template causing the issue.

<telerik:GridTemplateColumn UniqueName="Symbol">
                    <HeaderTemplate>
                        <asp:Label ID="labelHSymbol" runat="server" Text="Symbol"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table width="70px">
                            <colgroup>
                                <col />
                            </colgroup>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="labelSymbol" runat="server" Text='<%# Bind("Symbol") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>

If you see the code above, I'm using three rows table format where data is present only for third row, other two rows are empty. During PDF export, third row data is getting shifted to first row and finally that is creating complete misalignment in PDF file.

I tried fixing this alignment issues in OnPDFExporting Event but it didn't work in this scenario, pasted the code below -
Approach-1:
protected void TestGrid_PDFExporting(object sender, GridPdfExportingArgs e)
        {
            foreach (GridHeaderItem headerItem in gridIP.MasterTableView.GetItems(GridItemType.Header))
            {
                headerItem.Style["background-color"] = "Gray";
            }
        }
 
Approach-2:
  protected void TestGrid_PDFExporting(object sender, GridPdfExportingArgs e)
        {
            foreach (GridHeaderItem headerItem in gridIP.MasterTableView.GetItems(GridItemType.Header))
            {
                foreach (TableCell cell in headerItem.Cells)
                {
                    cell.Style["color"] = "#FF00FF";
                }
            }
        }

Please help me to investigate this issue, I'm pasting the entire piece of code below -

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
namespace PDFXLDownload
{
    public class MyTestEntity
    {
        public string InvName { get; set; }
        public string ShortName { get; set; }
        public string Status { get; set; }
        public string Symbol { get; set; }
        public string MSRating { get; set; }
        public string NERatio { get; set; }
        public string GERatio { get; set; }
        public string OneQ { get; set; }
        public string YT { get; set; }
        public string OneY { get; set; }
        public string ThreeY { get; set; }
        public string FiveY { get; set; }
        public string TenY { get; set; }
        public string ThreeYR { get; set; }
 
        public static List<MyTestEntity> GetInvestmentPerformanceData()
        {
            List<MyTestEntity> investments = new List<MyTestEntity>
            {
                new MyTestEntity
                { 
                    InvName = "Test Inv Name 1", ShortName="IA-RT", Status="A",
                    Symbol = "N/A", MSRating="2", NERatio="0.46", GERatio="0.46",
                    OneQ="00.00%", YT="00.00%", OneY="00.00%", ThreeY="00.00%", FiveY="00.00%",
                    TenY="00.00%", ThreeYR="00.00%"
                },
                 new MyTestEntity
                { 
                    InvName = "Test Inv Name 2", ShortName="IA-YE", Status="C",
                    Symbol = "N/A", MSRating="2", NERatio="0.46", GERatio="0.46",
                    OneQ="00.00%", YT="00.00%", OneY="00.00%", ThreeY="00.00%", FiveY="00.00%",
                    TenY="00.00%", ThreeYR="00.00%"
                },
                 new MyTestEntity
                { 
                     InvName = "Test Inv Name 3", ShortName="IA-RT", Status="B",
                    Symbol = "N/A", MSRating="3", NERatio="0.46", GERatio="0.46",
                    OneQ="00.00%", YT="00.00%", OneY="00.00%", ThreeY="00.00%", FiveY="00.00%",
                    TenY="00.00%", ThreeYR="00.00%"
                },
                 new MyTestEntity
                { 
                    InvName = "Test Inv Name 4", ShortName="IA-RT", Status="D",
                    Symbol = "N/A", MSRating="4", NERatio="0.46", GERatio="0.46",
                    OneQ="00.00%", YT="00.00%", OneY="00.00%", ThreeY="00.00%", FiveY="00.00%",
                    TenY="00.00%", ThreeYR="00.00%"
                }
            };
            return investments;
        }
    }
}

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PDFXLDownload.aspx.cs"
    Inherits="PDFXLDownload.PDFXLDownload" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    <link href="Styles/Site.css" rel="stylesheet" type="text/css" />
    <link href="Grid.Default.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnableScriptCombine="false">
    </telerik:RadScriptManager>
    <telerik:RadGrid runat="server" ID="gridIP" EnableEmbeddedSkins="false" GridLines="None"
        ShowFooter="false" AllowFilteringByColumn="false" AllowSorting="false" ShowGroupPanel="false"
        AllowPaging="false" OnPdfExporting="TestGrid_PDFExporting">
        <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Bottom">
            <Columns>
                <telerik:GridTemplateColumn UniqueName="InvName">
                    <HeaderTemplate>
                        <asp:Label ID="labelHInvName" runat="server" Text="Inv Name"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table width="200px">
                            <colgroup>
                                <col />
                            </colgroup>
                            <tr>
                                <td>
                                    <asp:Label ID="label1" runat="server" Text="AC Test Data One"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="label2" runat="server" Text="AC Test Data Two"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="labelInvName" runat="server" Text='<%# Bind("InvName") %>'></asp:Label>  
                                    <asp:Label ID="labelShortName" runat="server" Text='<%# Bind("ShortName") %>'></asp:Label>  
                                    <asp:Label ID="labelStatus" runat="server" CssClass="FundStatus" Text='<%# Bind("Status") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="Symbol">
                    <HeaderTemplate>
                        <asp:Label ID="labelHSymbol" runat="server" Text="Symbol"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table width="70px">
                            <colgroup>
                                <col />
                            </colgroup>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="labelSymbol" runat="server" Text='<%# Bind("Symbol") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="MSRating">
                    <HeaderTemplate>
                        <asp:Label ID="labelHMSRating" runat="server" Text="MSRating"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table width="70px">
                            <colgroup>
                                <col />
                            </colgroup>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="labelMSRating" runat="server" Text='<%# Bind("MSRating") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="NERatio">
                    <HeaderTemplate>
                        <asp:Label ID="labelHNERatio" runat="server" Text="NERatio"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table width="70px">
                            <colgroup>
                                <col />
                            </colgroup>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="labelNERatio" runat="server" Text='<%# Bind("NERatio") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="GERatio">
                    <HeaderTemplate>
                        <asp:Label ID="labelHGERatio" runat="server" Text="GERatio"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table width="70px">
                            <colgroup>
                                <col />
                            </colgroup>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="labelGERatio" runat="server" Text='<%# Bind("GERatio") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="OneQ">
                    <HeaderTemplate>
                        <asp:Label ID="labelHOneQ" runat="server" Text="OneQ"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table width="70px">
                            <colgroup>
                                <col />
                            </colgroup>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="labelOneQ" runat="server" Text='<%# Bind("OneQ") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="YT">
                    <HeaderTemplate>
                        <asp:Label ID="labelHYT" runat="server" Text="YTenure"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table width="70px">
                            <colgroup>
                                <col />
                            </colgroup>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="labelYT" runat="server" Text='<%# Bind("YT") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="OneY">
                    <HeaderTemplate>
                        <asp:Label ID="labelHOneY" runat="server" Text="OneY"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table width="70px">
                            <colgroup>
                                <col />
                            </colgroup>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="labelOneY" runat="server" Text='<%# Bind("OneY") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="ThreeY">
                    <HeaderTemplate>
                        <asp:Label ID="labelHThreeY" runat="server" Text="ThreeY"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table width="70px">
                            <colgroup>
                                <col />
                            </colgroup>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="labelThreeY" runat="server" Text='<%# Bind("ThreeY") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="FiveY">
                    <HeaderTemplate>
                        <asp:Label ID="labelHFiveY" runat="server" Text="FiveY"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table width="70px">
                            <colgroup>
                                <col />
                            </colgroup>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="labelFiveY" runat="server" Text='<%# Bind("FiveY") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="TenY">
                    <HeaderTemplate>
                        <asp:Label ID="labelHTenY" runat="server" Text="TenY"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table width="70px">
                            <colgroup>
                                <col />
                            </colgroup>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="labelTenY" runat="server" Text='<%# Bind("TenY") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="ThreeYR">
                    <HeaderTemplate>
                        <asp:Label ID="labelHThreeYR" runat="server" Text="ThreeYR"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table width="70px">
                            <colgroup>
                                <col />
                            </colgroup>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="labelThreeYR" runat="server" Text='<%# Bind("ThreeYR") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
            <CommandItemStyle HorizontalAlign="Left" Wrap="true" Width="100%" />
            <CommandItemTemplate>
                <asp:Label ID="lblText" runat="server" Visible="false" Width="100%"></asp:Label>
            </CommandItemTemplate>
        </MasterTableView>
    </telerik:RadGrid>
    <asp:Button ID="DownloadPDFButton" runat="server" OnClick="DownloadPDFButton_Click"
        Text="Download PDF" Width="184px" />
    <asp:Button ID="DownloadXLButton" runat="server" OnClick="DownloadXLButton_Click"
        Text="Download Exel" Width="157px" />
    </form>
</body>
</html>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.IO;
 
namespace PDFXLDownload
{
    public partial class PDFXLDownload : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            gridIP.DataSource = MyTestEntity.GetInvestmentPerformanceData();
            gridIP.DataBind();
        }
 
        protected void TestGrid_PDFExporting(object sender, GridPdfExportingArgs e)
        {
            string rowHtml = e.RawHTML.ToString();
 
            e.RawHTML = rowHtml.Replace("<td></td>", "<td style=\"height:20px\"></td>");
 
        }
 
        protected void DownloadPDFButton_Click(object sender, EventArgs e)
        {
            gridIP.ExportSettings.OpenInNewWindow = true;
 
            gridIP.ExportSettings.FileName = "PDFExportDemo";
            gridIP.ExportSettings.ExportOnlyData = false;
 
            //Landscape
            gridIP.ExportSettings.Pdf.PageHeight = Unit.Parse("10in");
            gridIP.ExportSettings.Pdf.PageWidth = Unit.Parse("16in");
 
            //// 1/2 inch margins
            gridIP.ExportSettings.Pdf.PageLeftMargin = Unit.Parse("1in");
            gridIP.ExportSettings.Pdf.PageRightMargin = Unit.Parse("1in");
            gridIP.ExportSettings.Pdf.PageTopMargin = Unit.Parse("1in");
            gridIP.ExportSettings.Pdf.PageBottomMargin = Unit.Parse("1in");                     
 
            gridIP.ExportSettings.FileName = "Test Pdf File";
 
            gridIP.MasterTableView.Columns.FindByUniqueName("InvName").HeaderStyle.Width = Unit.Pixel(200);
 
            gridIP.MasterTableView.ExportToPdf();
        }    
 
        protected void DownloadXLButton_Click(object sender, EventArgs e)
        {
            gridIP.ExportSettings.OpenInNewWindow = true;
             
            gridIP.ExportSettings.FileName = "MyTestEntity";
            gridIP.ExportSettings.Excel.FileExtension = "xls";
             
            gridIP.MasterTableView.ExportToExcel();
        }
 
        
    }   
}

                  
Mike
Top achievements
Rank 1
 answered on 29 May 2013
6 answers
358 views
I am able to create an excel attachment by dumping it into a memorystream and attach it to an email. 

However, when I try it as a PDF it doesn't work and throws an error that it's not a supported file type or has been damaged (for example it was sent as an email attachment and wasn't correctly decoded).

I am certain that I did not decode it correctly.  Here is what I have, the export works great, the email attachment does not.

How can I get the PDF into a memory stream to add it as an attachment to an email? 
protected void RadGrid1_PdfExporting(object sender, GridPdfExportingArgs e)
    {     
        StringBuilder customHTML = new StringBuilder();
        // customHTML.Append("<p style='color: red; font-weight: bold; font-size: 11pt;'>Offer Summary</p>");
        customHTML.Append("<table style='font-size: 10px; font-family:Arial Unicode MS;width:500px;'>");
        customHTML.Append("<colgroup><col style='width: 200px; white-space:nowrap;' /><col style='text-align:left;' /></colgroup>");
        // ColGroup = Number of <td> in a row is needed for Telerik export to PDF
        customHTML.Append("<tr><td>Customer: " + LabelCustomerName.Text + "</td><td>Agent: " + LabelAgentName.Text + " </td></tr>");
        customHTML.Append("<tr><td>Customer ID: " + LabelCustomerId.Text + "</td><td>Group ID: " + LabelGroupId.Text + " </td></tr>");
        customHTML.Append("<tr><td>Account Executive: " + LabelAccountExecutive.Text + "</td><td>Credit Status: " + LabelCreditStatus.Text + " </td></tr>");
        customHTML.Append("<tr><td>Account Manager: " + LabelAccountManager.Text + "</td><td>Review Date: " + LabelReviewDate.Text + " </td></tr>");
        customHTML.Append("</table>");
        customHTML.Append("<p></p>");
        e.RawHTML = customHTML + e.RawHTML;
 
        MemoryStream attachmentMemoryStream = new MemoryStream(new ASCIIEncoding().GetBytes(e.RawHTML));
 
        // Test Email
        SmtpClient smtpClient = new SmtpClient(Convert.ToString(ConfigurationManager.AppSettings["SERVER_EMAIL"]));
        string authType = "Basic";
        MailMessage email = new MailMessage();
        StringBuilder body = new StringBuilder();
        string emaURL = Convert.ToString(ConfigurationManager.AppSettings["BASE_URL"]);
        email.From = new MailAddress("someemail@gmail.com");
        email.CC.Add("myemail@gmail.com");
        email.Subject = "File_" + LabelCustomerName.Text + " - " + Convert.ToString(ConfigurationManager.AppSettings["SERVER_NAME"]) + " - Group " + LabelGroupId.Text;
        email.Attachments.Add(new Attachment(attachmentMemoryStream, "File_" + LabelCustomerName.Text + "_" + DateTime.Today.ToShortDateString() + ".pdf"));
        email.Body = body.ToString();
        email.IsBodyHtml = true;
        NetworkCredential nc = new NetworkCredential(RijndaelAlgorithm.Decrypt(Convert.ToString(ConfigurationManager.AppSettings["CredentialU"])), RijndaelAlgorithm.Decrypt(Convert.ToString(ConfigurationManager.AppSettings["CredentialP"])));
        smtpClient.Credentials = nc.GetCredential(Convert.ToString(smtpClient), 25, authType);
        smtpClient.Send(email);
    }
Mike
Top achievements
Rank 1
 answered on 29 May 2013
2 answers
144 views
when I enter 1/1/29 it autocompletes to 1/1/2029 but if I do 1/1/30 I get 1/1/1930
I am using v 2013.1.417.35 - the latest as of 24-May-2013

How can I make it go to 1/1/2030

Alastair
Jenni
Top achievements
Rank 1
 answered on 29 May 2013
1 answer
152 views
Hi

We are currently working on ASP.Net 3.5, Telerik 2011 and almost supporting all browsers except IE 10. We tried to use Telerik 2013 Q1 but we are facing problem in rad grid, few buttons and few css we are seeing different. Do you have any suggestion for us how to go ahead and make this working?

Thanks,
Pradip
Venelin
Telerik team
 answered on 29 May 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?