Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
155 views
Hi,

we are facing formatting issues while exporting the GRID to PDF.

some of the columns in the grid are not shown in the PDF. This problem exist if we have more than 3 columns in the grid.

Export to Excel & Export to Word are working properly.

Below is the code we are using. 

In .aspx

<telerik:RadGrid ID="rdgRoles" runat="server" DataSourceID="dsRoles"  OnItemCommand="RdgRolesItemCommand" Width="990px"
 ValidationSettings-ValidationGroup="valgrpSettings">
<MasterTableView AutoGenerateColumns="false" DataKeyNames="RoleId" CommandItemDisplay="Top"
CommandItemSettings-AddNewRecordImageUrl="../Images/App/addRole.png" CommandItemSettings-AddNewRecordText=""
 PagerStyle-AlwaysVisible="True" AllowPaging="True" AllowSorting="true">
 <CommandItemSettings ShowExportToExcelButton="True" ShowExportToWordButton="True"
 ShowExportToPdfButton="True" ShowRefreshButton="False"></CommandItemSettings>
 <Columns>
<telerik:GridTemplateColumn UniqueName="template"  HeaderStyle-Width="50px" ItemStyle-Width="50px">
<ItemTemplate>
<asp:ImageButton ID="imgEdit" runat="server" ToolTip="Edit" CommandName="EditRole"
     ImageUrl="~/Images/App/icon_edit.gif" />
<asp:ImageButton ID="imgbtnDelete" ToolTip="Delete" runat="server" CommandName="Delete"
     ImageUrl="~/Images/App/icon_delete.gif" OnClientClick="return confirm('Are you sure want to Delete this Role?');" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Role" HeaderStyle-Width="200px" ItemStyle-Width="200px" SortExpression="Role" >
<ItemTemplate>
<span class="wordwrapcontentnormal" style="width:200px;">
<asp:Label ID="lblRole" runat="server" Text='<%# Bind("Role") %>'></asp:Label>
</span>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="Description" DataField="Description" MaxLength="500"  HeaderStyle-Width="300px" ItemStyle-Width="300px">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Permission Level"  HeaderStyle-Width="200px" ItemStyle-Width="200px" SortExpression="PermissionLevel">
<ItemTemplate>
<span class="wordwrapcontentnormal" style="width:200px;">
<asp:Label ID="lblPermission" runat="server" Text='<%# Eval("PermissionLevel") %>'></asp:Label>
</span>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridCheckBoxColumn UniqueName="Active" HeaderText="Active" DataField="Active"  HeaderStyle-Width="50px" ItemStyle-Width="50px">
</telerik:GridCheckBoxColumn>
<telerik:GridTemplateColumn UniqueName="ActiveString" HeaderText="Active" HeaderStyle-Width="50px" ItemStyle-Width="50px"  Visible="false" ItemStyle-VerticalAlign="Top">
<ItemTemplate>
<%# Eval("ActiveString") %>                                                                     
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
 </telerik:RadGrid>

In Code behind

protected void RdgRolesItemCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == RadGrid.ExportToExcelCommandName ||
                e.CommandName == RadGrid.ExportToWordCommandName ||
                e.CommandName == RadGrid.ExportToCsvCommandName ||
                e.CommandName == RadGrid.ExportToPdfCommandName)
                {


                    rdgRoles.ExportSettings.ExportOnlyData = true;
                    rdgRoles.ExportSettings.IgnorePaging = true;
                    rdgRoles.ExportSettings.OpenInNewWindow = true;
                    rdgRoles.ExportSettings.FileName = GlobalHelper.ExportFileName(Resources.Messages.RoleExportFileName);


                    GlobalHelper.IsExport = true;
                    rdgRoles.MasterTableView.GetColumn("template").Visible = false;
                    rdgRoles.MasterTableView.GetColumn("Active").Visible = false;
                    rdgRoles.MasterTableView.GetColumn("ActiveString").Visible = true;
                }


                switch (e.CommandName)
                {
                    case RadGrid.ExportToExcelCommandName:
                        rdgRoles.MasterTableView.ExportToExcel();


                        break;


                    case RadGrid.ExportToCsvCommandName:
                        rdgRoles.ExportSettings.ExportOnlyData = false;
                        rdgRoles.MasterTableView.ExportToCSV();
                        break;


                    case RadGrid.ExportToPdfCommandName:
                        rdgRoles.MasterTableView.ExportToPdf();
                        break;


                    case RadGrid.ExportToWordCommandName:
                        rdgRoles.MasterTableView.ExportToWord();
                        break;
                }

            }
            catch (Exception ex)
            {
                
            }
        }
        
Can you please provide solution for this?

Thanks in advance.  


Princy
Top achievements
Rank 2
 answered on 21 Mar 2012
1 answer
78 views
Hi, I'm looking an either client-side or server-side to either append '*' to the Folder Name or switch the icon.  Right now, we're only allowing members to download the files and we keep that the download status.

Thanks
Vinh Vu
Dobromir
Telerik team
 answered on 21 Mar 2012
1 answer
75 views
Can you send me the sample code to describe how to use raddatapager control with radgridview....Your demo site doesnot explain the pager control with gridview.
Thanks
Princy
Top achievements
Rank 2
 answered on 21 Mar 2012
1 answer
142 views
How can I implement to popup the image over the small image in the grid image Column when mouse over on that Grid cell?


Thanks
Andrey
Telerik team
 answered on 21 Mar 2012
3 answers
81 views
Hi,

Is there any way to display scroll bars for the grid on touch devices?  I'm concerned our users won't recognize there is more to the list since there isn't a visual cue on my grid.

Thanks,
Andrew
Marin
Telerik team
 answered on 21 Mar 2012
0 answers
62 views
I HAVE TWO BUTTONS(WITH NAME UPDATE AND REFRESH) IN RAD TOOL BAR. I SET BOTH BUTTONS POSTBACK TO TRUE.AND I  AM CHECKING POSTBACK OF BUTTONS IN RAD TOOLBAR BUTTONCLICK EVENT.WHEN I CLICK ONLY ON UPDATE BUTTON THE REFRESH BUTTON ALSO POSTBACK HOW TO AVOID THIS
Muhammad
Top achievements
Rank 1
 asked on 21 Mar 2012
1 answer
62 views
I'm using RadScheduler with WebService binding and I want to avoid the following behavior: 
In MonthView, lets say March is displayed and the last three days of February are at the beginning. When I click on 29th of February, the scheduler automatically switches the view to February.

I'd like the view to stay on March (with those three days on Feb).
I've seen it done throughout Telerik's demos and I presume it's a simple setting, but I can't seem to find it.

Any help would be appreciated it.


Thanks.
Plamen
Telerik team
 answered on 21 Mar 2012
4 answers
365 views
Dear Support,
We are trying telerik RadControls for ASP.NET AJAX,
we have a scenario upon which the rad grid columns are not fixed, i.e. they are loaded at runtime, so we set the following in .aspx page.

 
<telerik:RadGrid  ID="RadGrid1" runat="server" AutoGenerateColumns="False" GridLines="None">
       <MasterTableView Dir="RTL" >
       </MasterTableView>
       <ClientSettings>
       <Scrolling AllowScroll="true" UseStaticHeaders="true" />
       </ClientSettings>
       </telerik:RadGrid>

and in the .net code, we wrote the following in the Page_Load:
If Not Page.IsPostBack Then
            Dim dt As DataTable
            dt = OpenDT("SELECT * FROM my_table ")
 
            Dim column1 As New GridBoundColumn
            Dim j As Integer
            For j = 0 To 10 'dt.Columns.Count - 1
                column1 = New GridBoundColumn
                RadGrid1.MasterTableView.Columns.Add(column1)
                column1.DataField = "DataEntryDate"
                column1.HeaderText = "Column " & j
                column1.ItemStyle.Width = "1000"
            Next j
 
            RadGrid1.DataSource = dt
            RadGrid1.DataBind()
End If

the problem is that the columns' width is not applied, cell wrapping is occurring (as in the attached file). However, if we add only 5 columns to the grid the columns' width is correct as in attached screen shot 2.
Any suggestions are appreciated.

thank you.
Baji
Top achievements
Rank 1
 answered on 21 Mar 2012
1 answer
197 views
I'm not sure what I'm doing wrong and even though it's rather small issue, it's an annoying one. I'm sure it's an easy fix, but I can't figure it out.

Basically, on my RadChart I'm using scale breaks and where the break actually occurs the numbers on the y-axis get jumbled up/overlap each other, making it difficult to read.

Here's the code on the aspx page:
<telerik:RadChart ID="rcTotalCaseTypes" AutoLayout="true" runat="Server" Width="900px"
           Skin="Telerik" Style="margin: 0px auto;" IntelligentLabelsEnabled="True">
           <Legend Visible="true">
               <Appearance GroupNameFormat="#VALUE">
               </Appearance>
           </Legend>
           <ChartTitle TextBlock-Text="Total Cases by Category">
               <TextBlock>
                   <Appearance TextProperties-Font="Verdana, 20px, style=Bold" TextProperties-Color="#00529B">
                   </Appearance>
               </TextBlock>
           </ChartTitle>
           <PlotArea>
               <Appearance Dimensions-Margins="18%, 22%, 12%, 14%">
               </Appearance>
               <XAxis DataLabelsColumn="PrettyMonthYr">
                   <Appearance>
                       <TextAppearance TextProperties-Font="Verdana, 8pt, style=Bold">
                       </TextAppearance>
                   </Appearance>
               </XAxis>
               <YAxis LabelStep="5" ScaleBreaks-Enabled="true" AutoScale="False">
                   <Appearance ValueFormat="None">
                       <TextAppearance TextProperties-Font="Verdana, 8pt, style=Bold">
                       </TextAppearance>
                       <MajorGridLines Width="3" PenStyle="Dash" />
                       <MinorGridLines Visible="false" />
                   </Appearance>
               </YAxis>
           </PlotArea>
       </telerik:RadChart>

On the code behind (this code is executed on Page_Init):
var data = SPs.RptNumberOfCasesByType(locationID).ExecuteTypedList<InvoiceCategoryNumbers>();
ChartMonths = new List<DateTime>();
 
var primaryKnee = new ChartSeries
{
    Name = "PK Cases",
    Type = ChartSeriesType.Bar,
    YAxisType = ChartYAxisType.Primary
};
 
var revisionKnee = new ChartSeries
{
    Name = "RK Cases",
    Type = ChartSeriesType.Bar,
    YAxisType = ChartYAxisType.Primary
};
 
var hipCases = new ChartSeries
{
    Name = "Hip Cases",
    Type = ChartSeriesType.Bar,
    YAxisType = ChartYAxisType.Primary
};
 
var rxCases = new ChartSeries
{
    Name = "Rx Cases",
    Type = ChartSeriesType.Bar,
    YAxisType = ChartYAxisType.Primary
};
 
var otherCases = new ChartSeries
{
    Name = "Other Cases",
    Type = ChartSeriesType.Bar,
    YAxisType = ChartYAxisType.Primary
};
 
 
data.ForEach(c =>
                {
                    ChartMonths.Add(Convert.ToDateTime(c.YearMo + "-01"));
 
                    var barTooltip = string.Format("<b>{0}</b><br /># of Cases: {1}<br />Total Sales: {2:C}", c.Category, c.NumInvoices, c.TotalSold);
                    var barSeriesItem = new ChartSeriesItem(Convert.ToDouble(c.NumInvoices), c.Category) { Name = c.Category };
                    barSeriesItem.Label.Visible = false;
                    barSeriesItem.Label.ActiveRegion.Tooltip = barTooltip;
                    barSeriesItem.ActiveRegion.Tooltip = barTooltip;
 
 
                    switch (c.InvoiceCategoryID)
                    {
                        case -1:
                            otherCases.AddItem(barSeriesItem);
                            break;
                        case 1:
                            primaryKnee.AddItem(barSeriesItem);
                            break;
                        case 2:
                            revisionKnee.AddItem(barSeriesItem);
                            break;
                        case 3:
                            hipCases.AddItem(barSeriesItem);
                            break;
                        case 11:
                            rxCases.AddItem(barSeriesItem);
                            break;
                    }
                });
rcTotalCaseTypes.Series.Add(primaryKnee);
rcTotalCaseTypes.Series.Add(revisionKnee);
rcTotalCaseTypes.Series.Add(hipCases);
rcTotalCaseTypes.Series.Add(rxCases);
rcTotalCaseTypes.Series.Add(otherCases);
rcTotalCaseTypes.DataBind();
 
rcTotalCaseTypes.PlotArea.XAxis.Clear();
if (ChartMonths.Count > 0)
{
    var uniqueMonths = new HashSet<DateTime>(ChartMonths);
    uniqueMonths.ToList().ForEach(m => rcTotalCaseTypes.PlotArea.XAxis.AddItem(m.ToString("MM/yyyy")));
}
 
rcTotalCaseTypes.PlotArea.YAxis.ScaleBreaks.Segments.Add(new AxisSegment() { MinValue = 0, MaxValue = 150, Step = 10 });
rcTotalCaseTypes.PlotArea.YAxis.ScaleBreaks.Segments.Add(new AxisSegment() { MinValue = 151, MaxValue = 500, Step = 10 });

I'd prefer not to have to manually create segments, but if I have to I will. 

Thank you for your help!
Peshito
Telerik team
 answered on 21 Mar 2012
9 answers
255 views
Hi Guys,
I have a table with two rows, the first row contains a web user control with a classic toolbar control, the second row contains a RadEditor (v 2009.2.701.35). So basically, I want to have my RadEditor consuming the 100% of my remaining content area, but I don't want to use a fixed size because it will work for a "Hardcode" screen resolution.  I noticed that default height value is 400px, but if I set a width value of 100% it is interpret as 100px (bug??). Is there any way to accomplish this UI requirement?

Thanks
tasos
Top achievements
Rank 1
 answered on 21 Mar 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?