Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
257 views
hello all ,
i try to export radgrid to pdf but it still blank,

this is my client side code :

         <telerik:RadGrid runat="server" ID="ReservationsGrid" MasterTableView-ShowHeadersWhenNoRecords="true" OnPdfExporting="ReservationsGrid_PdfExporting" OnNeedDataSource="ReservationsGrid_NeedDataSource" OnGridExporting="ReservationsGrid_GridExporting"
                    AutoGenerateColumns="false" AllowPaging="true" OnItemCommand="ReservationsGrid_ItemCommand" >
                    <PagerStyle PageSizes="10" />
                    <ExportSettings ExportOnlyData="true" Excel-Format="Html"></ExportSettings>
                    <MasterTableView CommandItemDisplay="Top" UseAllDataFields="true">
                        <CommandItemSettings ShowExportToPdfButton="true" ShowExportToExcelButton="true" ShowExportToCsvButton="true" ShowExportToWordButton="true" ></CommandItemSettings>
                        <Columns>
.........

and i've a radajaxmanager :

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <ClientEvents OnRequestStart="onRequestStart" />
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="ReservationsGrid">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="ReservationsGrid" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>



with this script  function :
<script type="text/javascript">
    function onRequestStart(sender, args) {
        if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                args.get_eventTarget().indexOf("ExportToPdfButton") >= 0 ||
            args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {
            args.set_enableAjax(false);
            
        }
    }
</script>



my code behind is :
protected void ReservationsGrid_ItemCommand(object sender, GridCommandEventArgs e)
 {
     switch (e.CommandName)
     {
         case RadGrid.ExportToPdfCommandName:
              
             ConfigureExport();
             ReservationsGrid.MasterTableView.ExportToPdf();
             break;
 
         case RadGrid.ExportToExcelCommandName:
             ConfigureExport();
             ReservationsGrid.MasterTableView.ExportToExcel();
             break;
 
         case RadGrid.ExportToCsvCommandName:
             ConfigureExport();
             ReservationsGrid.MasterTableView.ExportToCSV();
             break;
 
         case RadGrid.ExportToWordCommandName:
             ConfigureExport();
             ReservationsGrid.MasterTableView.ExportToCSV();
             break;
 
         default:break;
     }
    
 }
 
 public void ConfigureExport()
 {
     ReservationsGrid.ExportSettings.ExportOnlyData = true;
     ReservationsGrid.ExportSettings.IgnorePaging = true;
     ReservationsGrid.ExportSettings.OpenInNewWindow = true;
 }


thanks in advance .
Roukaya
Top achievements
Rank 2
 answered on 03 Jan 2013
8 answers
333 views
I've been stuggling with this issue all day long and can't figure out how to setfocus to a RadComboBox control.  When the sefocus method is called for a particlular control I can see the cursor enter into the textbox of the control but then it moves to the dropdown button. What am I doing wrong??
protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindPage();
                ActionDate.SelectedDate = DateTime.Now;
                SetFocus(ddlUserName.ClientID + "_Input");
            }
 
        }

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="QuickTicketDetail.aspx.cs"
    Inherits="TED.Web.PopUps.QuickTicketDetail" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <script type="text/javascript">
        function CloseAndRebind(args) {
            GetRadWindow().BrowserWindow.refreshGrid(args);
            GetRadWindow().close();
        }
 
        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well)
 
            return oWindow;
        }
 
        function CancelEdit() {
            GetRadWindow().close();
        }
    </script>
    <asp:ValidationSummary ID="valSummary" runat="server" ValidationGroup="valSummary"
        DisplayMode="BulletList" ShowMessageBox="true" ShowSummary="false" />
    <div style="float: left;">
        <asp:LinkButton ID="lnkSave" runat="server" SkinID="LinkButton_Save" CssClass="LinkButton"
            OnClick="Save" CausesValidation="true" ValidationGroup="valSummary"></asp:LinkButton>
    </div>
    <br />
    <br />
    <div class="divLabel">
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td>
                    <asp:Label ID="lblWhatHappened" runat="server" SkinID="Label_Bold_8pt" Text="What Happened:"
                        Width="100px"></asp:Label>
                </td>
                <td>
                    <telerik:RadEditor ID="TicketDetail" runat="server" Width="350" Height="100" Skin="Web20"
                        StripFormattingOptions="All" AllowScripts="false" EditModes="Design">
                        <CssFiles>
                            <telerik:EditorCssFile Value="../App_Themes/Control Themes/EditorContentArea.css" />
                        </CssFiles>
                        <Tools>
                            <telerik:EditorToolGroup>
                                <telerik:EditorTool Name="AjaxSpellCheck" />
                            </telerik:EditorToolGroup>
                        </Tools>
                    </telerik:RadEditor>
                    <asp:RequiredFieldValidator ID="rfvTDTicketDetail1" runat="server" ControlToValidate="TicketDetail"
                        ErrorMessage="What Happened" ValidationGroup="valSummary">*</asp:RequiredFieldValidator>
                </td>
                <td>
                    <asp:CheckBox ID="cbInternal" runat="server" SkinID="CheckBox" Text="Internal Update"
                        TextAlign="Right" />
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblWhatsNext" runat="server" SkinID="Label_Bold_8pt" Text="Whats next:"
                        Width="100px"></asp:Label>
                </td>
                <td>
                    <telerik:RadEditor ID="Next" runat="server" Width="350" Height="100" Skin="Web20"
                        StripFormattingOptions="All" AllowScripts="false" EditModes="Design">
                        <CssFiles>
                            <telerik:EditorCssFile Value="../App_Themes/Control Themes/EditorContentArea.css" />
                        </CssFiles>
                        <Tools>
                            <telerik:EditorToolGroup>
                                <telerik:EditorTool Name="AjaxSpellCheck" />
                            </telerik:EditorToolGroup>
                        </Tools>
                    </telerik:RadEditor>
                    <asp:RequiredFieldValidator ID="rfvNext" runat="server" ControlToValidate="next"
                        ErrorMessage="Whats Next" ValidationGroup="valSummary">*</asp:RequiredFieldValidator>
                </td>
            </tr>
        </table>
    </div>
    <div class="divLabel">
        <asp:Label ID="lblActionDate" runat="server" SkinID="Label_Bold_8pt" Text="Action Date:"
            Width="100px"></asp:Label>
        <telerik:RadDatePicker ID="ActionDate" runat="server" Width="90px">
        </telerik:RadDatePicker>
        <asp:RequiredFieldValidator ID="rfvActionDate" runat="server" ControlToValidate="ActionDate"
            ErrorMessage="Action Date Required" Text="*" ValidationGroup="valSummary"></asp:RequiredFieldValidator>
    </div>
    <div class="divLabel">
        <asp:Label ID="lblTDCommunicationType" runat="server" SkinID="Label_Bold_8pt" Text="Comm Type:"
            Width="100px"></asp:Label>
        <telerik:RadComboBox ID="ddlCommunicationType" runat="server" Skin="Web20" AllowCustomText="false"
            MarkFirstMatch="true" Width="100px">
        </telerik:RadComboBox>
        <asp:RequiredFieldValidator ID="rfvCommType" runat="server" ControlToValidate="ddlCommunicationType"
            ErrorMessage="Communication Type Required" Text="*" ValidationGroup="valSummary"></asp:RequiredFieldValidator>
    </div>
    <div class="divLabel">
        <asp:Label ID="lblDTDetailTime" runat="server" Text="Detail Time: " SkinID="Label_Bold_8pt"
            Width="100px"></asp:Label>
        <asp:TextBox ID="txtTDTicketDetailTime" runat="server" Width="50px"></asp:TextBox>
        <asp:CompareValidator ID="cvTDTicketDetailTime" runat="server" ControlToValidate="txtTDTicketDetailTime"
            ErrorMessage="*" Operator="DataTypeCheck" Type="Currency" ValidationGroup="valSummary"></asp:CompareValidator>
        <asp:CompareValidator ID="cmvTicketDetailTime" runat="server" ControlToValidate="txtTDTicketDetailTime"
            ValueToCompare="0" Type="Currency" ErrorMessage="Detail time must be greater than 0"
            Text="*" ValidationGroup="valSummary" Operator="GreaterThan"></asp:CompareValidator>
        <telerik:RadComboBox ID="ddlType" runat="server" Skin="Web20" AllowCustomText="false"
            MarkFirstMatch="true" Width="75px">
            <Items>
                <telerik:RadComboBoxItem Text="Minutes" Value="1" Selected="true" />
                <telerik:RadComboBoxItem Text="Hours" Value="2" />
            </Items>
        </telerik:RadComboBox>
        <telerik:RadComboBox ID="ddlUserName" runat="server" Skin="Web20" AllowCustomText="false"
            MarkFirstMatch="true" Width="150px" AutoPostBack="true">
        </telerik:RadComboBox>
        <asp:Label ID="lblAssist" runat="server" Text="Asst:" SkinID="Label_Bold_8pt"></asp:Label>
        <telerik:RadComboBox ID="ddlAssistUser" runat="server" Skin="Web20" AllowCustomText="false"
            MarkFirstMatch="true" Width="150px" AutoPostBack="true">
        </telerik:RadComboBox>
    </div>
    <div class="divLabel">
    </div>
    </form>
</body>
</html>

Nencho
Telerik team
 answered on 03 Jan 2013
10 answers
209 views
I've got a form with a RadGrid which exports data to PDF and Excel.

On the web form both work without problem.  On Android the PDF works however the Excel file does not open - believes it is a CSV file and cannot open.

On an iPad neither will open - I just get a white blank window in place where the PDF should be and "Cannot open document" when trying to open Excel file.  Both android and iOS have Documents to Go installed.

has anybody got this working on iOS?

Cheers
Cliff
Daniel
Telerik team
 answered on 03 Jan 2013
0 answers
37 views
Dear Telerik Team 

How I can apply Load on demand on both combos 
and at the same time they are related ??

I apply "Load on demand" on both and works well
but I cannot make them related combo boxes ??

Does anyone tried this scenario before ??

Thanks 
Noha
Top achievements
Rank 1
 asked on 03 Jan 2013
1 answer
80 views
I am new to telerik control and analyzing the  scheduler to schedule the appointments, my requirement is bit different from usual scheduler flow. (ie. The appointment subject needs to be different for each schedule, a trainer can schedule a Class I to Class 12. In case i have schedule Class 1 with recurrence option, then it needs to generate the physical appointment upto 12. But the scheduler is creating one appointment and maintaining the recurrence option. Please guide how to use the scheduler in this scenario? ) 
Boyan Dimitrov
Telerik team
 answered on 03 Jan 2013
3 answers
117 views
Hi,

I have a below use case. Client want to schedule different type of appointments but at same time on different dates.

When we use rad scheduler it is creating one appointment in the db with recurrence rule updated. When i see the calendar with same subject i am seeing different appointments.

But my requirement i need to setup different apointments for example
Yoga - Mon - 10/11/2012 10:00 AM to 11:00AM
Swimming - Tue - 11/11/2012 10:00 AM to 11:00AM
Abs - Wed- 12/11/2012 10:00 AM to 11:00AM

Above three appointments i want to set using recurrence option in rad schedular. please let me know how can we do it.



Boyan Dimitrov
Telerik team
 answered on 03 Jan 2013
4 answers
426 views
Hello,

I am creating a dynamic RadGrid completely in the code. I am adding the buttons for ItemTemplates and EditItemTemplates for the Editing the controls. I am creating this in the Page_Init function.

The controls binds fine and displays the data and "Edit Button". But the problem is that when I click on the "Edit" button, the "ItemCommand" event does not fires for the grid and The grid is not displayed in edit mode. The Page only postback to the server and binds the grid again. But if i click on the "Delete" button, which is "BoundColumn", it does fire the "ItemCommand" event for the grid. What point I may be missing here ?

 Following is the code for it :

           
public class ItemTemplateLinks : ITemplate
 {
     protected RadButton rBtn;
     string colname = string.Empty;
     string colValue = string.Empty;
     public ItemTemplateLinks(string cName)
     {
         colname = cName;
     }
     public void InstantiateIn(System.Web.UI.Control container)
     {
         rBtn = new RadButton();
         rBtn.Text = "Edit";
         rBtn.ButtonType = RadButtonType.StandardButton;
         rBtn.Command += new CommandEventHandler(rBtn_Command);
         rBtn.CommandName = "Edit";
         Random rnd = new Random();
         rBtn.ID = "test";
         container.Controls.Add(rBtn);
     }
 
     void rBtn_Command(object sender, CommandEventArgs e)
     {
         string a = (sender as RadButton).CommandName;
     }
 }
 
 public class EditItemTemplateLinks : IBindableTemplate
 {
     ListItemType lstItemType;
     protected RadButton rBtn;
     string colname = string.Empty;
     string btnText = string.Empty;
     string cmdName = string.Empty;
     string colValue = string.Empty;
     public EditItemTemplateLinks(string cName, string bText, string bCmdName)
     {
         btnText = bText;
         bCmdName = cmdName;
         colname = cName;
     }
     public void InstantiateIn(System.Web.UI.Control container)
     {
         rBtn = new RadButton();
         rBtn.Text = "Update fire";
         rBtn.ButtonType = RadButtonType.StandardButton;
         rBtn.CommandName = "Update";
         rBtn.Command += new CommandEventHandler(rBtn_Command);
         Random rnd = new Random();
         rBtn.ID = "ssss";
          
         container.Controls.Add(rBtn);
     }
 
     void rBtn_Command(object sender, CommandEventArgs e)
     {
         string a = (sender as RadButton).CommandName;
     }
 
     public IOrderedDictionary ExtractValues(Control container)
     {
         OrderedDictionary od = new OrderedDictionary();
         return od;
     }
 }
RadGrid RadGrid1 = new RadGrid();
RadGrid1.NeedDataSource +=
new GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource);
           RadGrid1.ItemCommand += new GridCommandEventHandler(RadGrid1_ItemCommand);
           RadGrid1.ItemCreated += new GridItemEventHandler(RadGrid1_ItemCreated);
           RadGrid1.ID = "rgDemo";
           RadGrid1.Width = Unit.Percentage(100);
           RadGrid1.PageSize = 5;
           RadGrid1.AllowPaging = true;
           RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
           RadGrid1.AutoGenerateColumns = false;
           RadGrid1.GroupingEnabled = true;
           RadGrid1.ShowGroupPanel = true;
           RadGrid1.ShowStatusBar = true;
           RadGrid1.ClientSettings.AllowDragToGroup = true;
 
           RadGrid1.MasterTableView.PageSize = 15;
           RadGrid1.MasterTableView.DataKeyNames = new string[] { "ID" };
 
           RadGrid1.MasterTableView.EditFormSettings.EditFormType = GridEditFormType.Template;
           RadGrid1.MasterTableView.EditMode = GridEditMode.InPlace;
           GridTemplateColumn gtc = new GridTemplateColumn();
           gtc.ItemTemplate = new ItemTemplateLabels("Description");
           gtc.HeaderText = "Description";
           gtc.EditItemTemplate = new EditItemTemplateTextBoxes("Description");
           RadGrid1.MasterTableView.Columns.Add(gtc);
 
           GridTemplateColumn gt2 = new GridTemplateColumn();
           gt2.ItemTemplate = new ItemTemplateLabels("Name");
           gt2.HeaderText = "Name";
           gt2.EditItemTemplate = new EditItemTemplateTextBoxes("Name");
           RadGrid1.MasterTableView.Columns.Add(gt2);
 
 
           GridTemplateColumn gt3 = new GridTemplateColumn();
           gt3.ItemTemplate = new ItemTemplateLinks("Links");
           gt3.UniqueName = "EditCommandColumn";
           gt3.HeaderText = "Links";
           gt3.EditItemTemplate = new EditItemTemplateLinks("Links", "Update", "Update");
           RadGrid1.MasterTableView.Columns.Add(gt3);
 
 GridButtonColumn gBtnColumn = new GridButtonColumn();
           gBtnColumn.CommandName = "Delete";
           gBtnColumn.Text = "Delete";
           gBtnColumn.ButtonType = GridButtonColumnType.LinkButton;
           RadGrid1.MasterTableView.Columns.Add(gBtnColumn);


Harshit
Top achievements
Rank 1
 answered on 03 Jan 2013
1 answer
114 views
Hi,
i'm using  Auto-generated Edit Form to insert record to the data base.I have 20 text boxes to insert data.Now all the text boxes are display in one column (after one by one).I want to display this tetboxes using two columns.(Something like colspan 2). How can i do this ?.
Jayesh Goyani
Top achievements
Rank 2
 answered on 03 Jan 2013
2 answers
56 views
Hi All!

In my rad grid ,am using one label control and when we click on the label the label control should be changed to text box control and the value binded  in the label now it want to display in the text box control.

am using the label and textbox control in same grid template column.on initial loading am declaring the textbox visible to false.


thanks for ur help..........
Harees
Top achievements
Rank 1
 answered on 03 Jan 2013
2 answers
84 views
Hi,
i'm using  Auto-generated Edit Form to insert record to the data base.I have 20 text boxes to insert data.Now all the text boxes are display in one column (after one by one).I want to display this tetboxes using two columns.(Something like colspan 2). How can i do this ?.
Trs
Top achievements
Rank 1
 answered on 03 Jan 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?