Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
127 views
I'm having a problem with PDF exporting from RadGrid.
Basically the programmatic styles I apply to the columns and cells are not getting applied if I export using Internet Explorer. Firefox and Chrome work fine. I'm utterly at a loss as to how this happens, here is the style-specific code I use:

protected void btnExport_Click(object sender, EventArgs e) 
    { 
        isExport = true
        List_SelectedIndexChanged(new object(), new EventArgs()); //this applies a filter expression based on front end controls 
        ApplyColumnSettings(); 
        
        G1.ExportSettings.ExportOnlyData = true
        G1.ExportSettings.OpenInNewWindow = true
        G1.ExportSettings.FileName = "FileName"
        G1.ExportSettings.Pdf.Title = "Title"
        G1.ExportSettings.Pdf.Author = "Author"
        expanded = new bool[G1.Items.Count];             
        foreach (GridDataItem i in G1.Items) 
        { 
            if (i.Expanded) 
                expanded[i.ItemIndex] = true
            else 
                expanded[i.ItemIndex] = false
        } 
        G1.MasterTableView.ExportToPdf(); 
    } 
protected void ApplyColumnSettings() 
    { 
        foreach (GridColumn col in G1.MasterTableView.Columns) 
        {           
            switch (col.UniqueName) 
            { 
                case "exCol": col.Visible = falsebreak
                case "ExpandColumn": col.Visible = falsebreak
                case "ItemNumber": col.Visible = falsebreak
                case "ItemNumberLink": col.Visible = true; col.HeaderStyle.Width = Unit.Pixel(37);break
                case "COURSE_ID": col.HeaderStyle.Width = Unit.Pixel(130); break
                case "COURSE_TITLE": col.HeaderStyle.Width = Unit.Pixel(255); break
                case "INSTR_NAME": col.HeaderStyle.Width = Unit.Pixel(80); break
                case "day_CD": col.HeaderStyle.Width = Unit.Pixel(100); break
                case "time": col.HeaderStyle.Width = Unit.Pixel(120); break
                case "room_loc": col.HeaderStyle.Width = Unit.Pixel(130); break
                case "BRANCH": col.HeaderStyle.Width = Unit.Pixel(100); break
                case "type": col.HeaderStyle.Width = Unit.Pixel(70); break
                case "SeatsLeft": col.HeaderStyle.Width = Unit.Pixel(70); break
                case "cr": col.HeaderStyle.Width = Unit.Pixel(50); break
                 
            }                 
        } 
    } 
 
    protected void G1_ItemCreated(object sender, GridItemEventArgs e) 
    { 
        if (isExport)         
            ApplyPDFStyles(e.Item);         
    } 
 
protected void ApplyPDFStyles(GridItem item) 
    { 
        if (item is GridHeaderItem)                         
            item.Style["background-color"] = "#EEEEEE";         
        foreach (TableCell cell in item.Cells)         
            cell.Style["text-align"] = "left"
         
    } 
 


I've attached a picture showing how the header styles come out (the data fallows the same patterns), notice how the far right column gets chomped off all together...

Any ideas?
Adam
Top achievements
Rank 1
 answered on 05 Apr 2010
2 answers
492 views
Hello, I have recently migrated a scorecard system from the RadControls_Q1_2007_SP2 to RadControls_for_ASP.NET_AJAX_2009_3_1208_dev. One of the features that seemed to be inherently built in was a consistent format in the excel output. A large chunk of the data is in percent form. It displays fine in the grid, but when I am exporting it, it returns to a standard decimal format. The data stays correct, but I cannot get the percent format in the export. Here is the aspx for the column that is calculated from the data source.

                <telerik:GridBoundColumn Visible="False" DataField="AvgQA_Export" HeaderText="Avg. QA" UniqueName="colAvgQA_Export"
                    <HeaderStyle BackColor="#FFCC00" CssClass="rgYellow" HorizontalAlign="Center" /> 
                    <ItemStyle HorizontalAlign="Right" /> 
                </telerik:GridBoundColumn> 

Here is the codebehind  to generate the value of the field:

 Protected Sub rgScorecard_ItemDataBound(ByVal sender As ObjectByVal e As GridItemEventArgs) Handles rgScorecard.ItemDataBound 
   If TypeOf e.Item Is GridDataItem Then 
                Dim dataItem As GridDataItem = CType(e.Item, GridDataItem) 
  ' QA 
                ' -------------------------------------------- 
                If dataItem("colQAScore").Text = 0 Or dataItem("colQANumEvals").Text = 0 Then 
                    dataItem("colAvgQA").Text = "<a href='#' class='info'><span class='info'>" & dataItem("colSupName").Text & "<br>'Avg. QA'<br>GOAL: " & FormatPercent(m.goal("AvgQA"), 3) & "<hr>Total QA Score: " & dataItem("colQAScore").Text & "<br># QAs: " & dataItem("colQANumEvals").Text & "<hr>" & dataItem("colQAScore").Text & "/" & dataItem("colQANumEvals").Text & "</span>" & FormatPercent(0, 3) & "</a>" 
                    dataItem("colAvgQA_Export").Text = FormatPercent(0, 3) 
                Else 
                    dataItem("colAvgQA").Text = "<a href='#' class='info'><span class='info'>" & dataItem("colSupName").Text & "<br>'Avg. QA'<br>GOAL: " & FormatPercent(m.goal("AvgQA"), 3) & "<hr>Total QA Score: " & dataItem("colQAScore").Text & "<br># QAs: " & dataItem("colQANumEvals").Text & "<hr>" & dataItem("colQAScore").Text & "/" & dataItem("colQANumEvals").Text & "</span>" & FormatPercent(Double.Parse(dataItem("colQAScore").Text) / Integer.Parse(dataItem("colQANumEvals").Text) / 100, 3) & "</a>" 
                    dataItem("colAvgQA_Export").Text = FormatPercent(Double.Parse(dataItem("colQAScore").Text) / Integer.Parse(dataItem("colQANumEvals").Text) / 100, 3) 
                End If 
As you can see, we have a column with a span that creates a popup, and then a column appended with "_Export" That holds just the data.

We adjust the visibility on export as follows:

 Protected Sub btExcel_Click(ByVal sender As ObjectByVal e As EventArgs) Handles DateControl.Export 
 
        rgscorecard.Rebind  
        rgScorecard.Columns.FindByUniqueNameSafe("colAvgQA").Visible = False 
        rgScorecard.Columns.FindByUniqueNameSafe("colAvgQA_Export").Visible = True 
        rgScorecard.ExportSettings.OpenInNewWindow = True 
        rgScorecard.ExportSettings.ExportOnlyData = False 
        rgScorecard.ExportSettings.FileName = "Sups_Tiers_Scorecard_" & DateControl.SCFrom & "_thru_" & DateControl.SCTo 
        rgScorecard.MasterTableView.ExportToExcel() 
End Sub 

I've tried modifying the ExportOnlyData field, and adding the following as well, nothing seems to work to get the percent formatted. Any help would be greatly appreciated.

 
    Private Sub rgScorecard_ExcelExportCellFormatting(ByVal source As ObjectByVal e As Telerik.Web.UI.ExcelExportCellFormattingEventArgs) Handles rgScorecard.ExcelExportCellFormatting 
        If TypeOf e.FormattedColumn Is GridBoundColumn Then 
            Dim column As GridBoundColumn = CType(e.FormattedColumn, GridBoundColumn) 
            If column.HeaderText.Contains("%"Then 'ALL REQUIRED COLUMNS CONTAIN THE PERCENT SIGN IN THE HEADER 
                column.DataFormatString = "{0:D4}" 
            End If 
        End If 
    End Sub 




JSaultz
Top achievements
Rank 1
 answered on 05 Apr 2010
10 answers
179 views
    <asp:Panel ID="Panel1" runat="server" Width="800px" ScrollBars="Auto">  
        <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None"   
            AutoGenerateColumns="False" Skin="Office2007"   
            onneeddatasource="RadGrid1_NeedDataSource">  
            <MasterTableView DataKeyNames="PaymentFrequencyID" EditMode="InPlace" Width="2000px">  
                <Columns> 
                    <telerik:GridTemplateColumn DataField="Disabled" DataType="System.Boolean"   
                        HeaderText="Disabled"   
                        UniqueName="Disabled">  
                        <ItemTemplate> 
                            <asp:CheckBox ID="chkDisabled" runat="server" Checked='<%# Bind( "Disabled" ) %>' /> 
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                </Columns> 
            </MasterTableView> 
            <ClientSettings> 
                <Resizing AllowColumnResize="True" /> 
            </ClientSettings> 
        </telerik:RadGrid> 
        <asp:Button ID="Button1" runat="server" Text="Button" /> 
    </asp:Panel> 
 
Here is simple page
and below is the code
    class TestDIVBorder  
    {  
        public int PaymentFrequencyID { getset; }  
        public bool Disabled { getset; }  
    }  
 
    public partial class WebForm1 : System.Web.UI.Page  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
        }  
 
        protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)  
        {  
            var list = new List<TestDIVBorder>();  
            list.Add(new TestDIVBorder() { PaymentFrequencyID = 1, Disabled = true });  
            list.Add(new TestDIVBorder() { PaymentFrequencyID = 2, Disabled = true });  
            list.Add(new TestDIVBorder() { PaymentFrequencyID = 3, Disabled = true });  
            list.Add(new TestDIVBorder() { PaymentFrequencyID = 4, Disabled = true });  
            list.Add(new TestDIVBorder() { PaymentFrequencyID = 5, Disabled = true });  
 
            RadGrid1.DataSource = list;  
        }  
    }  
 

Below you can see 2 images when scroll in different positions and you may see the line. How can I fix it?
I see it this way only in IE8.
James Faw
Top achievements
Rank 1
 answered on 05 Apr 2010
0 answers
125 views
I went a different route on this one, and did a complete custom script that allows me to do a multiple upload without using the demo script, though I did use some of the code from it to complete the task.

I will make a demo later on on doing a custom Multi-Upload with Thumbnail creation for others to learn by.

Thank you for a awesome component set, works like a charm.
Wayne
Wayne Barron
Top achievements
Rank 1
 asked on 05 Apr 2010
1 answer
69 views
Hi ,
    I want to import a different css file for IE7 which i am able to achieve using the following.
 
  <!--[if gte IE 7]> 
  <style type="text/css">@import '/SharedResources/Css/actionheader_ie.css';</style> 
<![endif]-->


But, the above line disables Ajax. (It says RadAjaxManager is NULL) Any idea what could be the reason for this?
and also is there any other way to include different css file which will not disable Ajax?

Waiting for your reply.

Thank You.
Dimo
Telerik team
 answered on 05 Apr 2010
2 answers
183 views
Our FileExplorer looks for a folder called /uploaded-files/. Is there a way to auto-create this folder if it doesn't exist?
Chris Miller
Top achievements
Rank 1
 answered on 05 Apr 2010
2 answers
236 views
Hello,

I have a RadComboBox with a multi-checkbox setup. It is working fine but when try loop through the items and see if anything has been selected it is showing FALSE even when I have definitely selected some items.

My code is as follows:

foreach (RadComboBoxItem rcbi in cmbAccessories.Items) 
     if (rcbi.Selected) 
     { 
         //insert value in database 
     } 


<telerik:RadComboBox ID="cmbAccessories" Width="200px"  
                                OnClientDropDownOpening="OnClientDropDownOpening"  
                                EmptyMessage="...Select Accessories"  
                                OnClientDropDownClosing="OnClientDropDownClosing"  
                                OnClientSelectedIndexChanging="OnClientSelectedIndexChanging"  
                                OnClientBlur="OnClientBlur" DataTextField="Name" DataValueField="AccessoryID"  
                                ValidationGroup="valItem" HighlightTemplatedItems="false"  
                                AllowCustomText="True" Runat="server" ShowDropDownOnTextboxClick="False"  
                                EnableTextSelection="False"
                                <ItemTemplate> 
                                    <asp:CheckBox ID="chkBox" Text='<%#Eval("Name") %>' onclick="checkboxClick();" runat="server" /> 
                                </ItemTemplate>                                 
                                <FooterTemplate> 
                                    <div style="width:100%;" align="center"><asp:Label ID="lblCloseMe" Text="CLOSE [X]" onclick="CloseMe();" style="cursor:pointer;" runat="server" /></div
                                </FooterTemplate> 
                            </telerik:RadComboBox> 


darenkov
Top achievements
Rank 1
 answered on 05 Apr 2010
1 answer
181 views
Hi,

I have a grid with many GridBoundColumns and one GridTemplateColumn. The GridTemplateColumn has a ItemTemplate which is generated dynamically from code-behind. I have a place holder in the ItemTemplate in which a table is added programmatically.
<ItemTemplate>
                            <asp:placeholder id="DetailPlaceHolder" runat="server"></asp:placeholder>
</ItemTemplate>

The table for each row in the Radgrid is added to the placeholder in the OnItemDataBound event. The grid displays the data in the perfect manner as desired.However, my export functions are not including the dynamically generated tables. All the export functions ExportToExcel, ExportToCSV, ExportToWord donot include the dynamically generated table in the GridTemplateColumn. I can get the excel and word to work by making the ExportOnlyData="false", but then also my ExportToCSV is not working. Can anyone please tell me how to solve this problem ??
Daniel
Telerik team
 answered on 05 Apr 2010
1 answer
141 views
I would like to be able to drag a row in the grid by having the user click on an image or image button in the grid row.  Basically I have an image with the work "Drag" in it that the user would click to drag the row to a new position in the grid.  Any ideas on how to implement this?
Pavlina
Telerik team
 answered on 05 Apr 2010
3 answers
80 views
Hello,

I have a user control that is put into a template grid column, the problem is that i am getting the table inside the user control styled with [.RadGrid_Simple .rgRow TD], am not sure if there is a work around to avoid this cascade. but i think it should not even existed.

please let me know if you have a suggestion for a workaround.

Dimo
Telerik team
 answered on 05 Apr 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?