Hi,
Im using Q2 2012 and having two exporting issues with my ajaxified hierarchical RadGrids:
1-Exporting to Word exports Master and Details tables (all grid rows) whatever if rows are collapsed or expanded. Weird thing, exporting to Excel and PDF are not doing this (they export only Master and expended Details rows, as wanted).
2-Particular rows in my Details table contain a RadTooltip (RadTooltipManager) when mouse hovering on row text. Its working fine but once I trigger a tooltip to appear, the exporting (for Excel, PDF) only export the Master table, ignoring the expending/collapsing. The Word exporting still exports everything (issue #1).
After some research, Ive noted that using <MasterTableView HierarchyLoadMode="ServerBind"...> seems to solve the two issues mentioned but im using "Client" for a reason (especially, row collapsing/expanding on Master row click (rows that contains child only)).
Here is the code:
Markup:
 
 
 
 
 
 
 
 
 
 
 
Javascript:
 
 
 
 
 
 
 
 
 
 
 
 
Code-Behind:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
TooltipContainer markup:
 
TooltipContainer Code-Behind (GetUrl function code omitted):
 
 
 
 
 
 
TIA
                                Im using Q2 2012 and having two exporting issues with my ajaxified hierarchical RadGrids:
1-Exporting to Word exports Master and Details tables (all grid rows) whatever if rows are collapsed or expanded. Weird thing, exporting to Excel and PDF are not doing this (they export only Master and expended Details rows, as wanted).
2-Particular rows in my Details table contain a RadTooltip (RadTooltipManager) when mouse hovering on row text. Its working fine but once I trigger a tooltip to appear, the exporting (for Excel, PDF) only export the Master table, ignoring the expending/collapsing. The Word exporting still exports everything (issue #1).
After some research, Ive noted that using <MasterTableView HierarchyLoadMode="ServerBind"...> seems to solve the two issues mentioned but im using "Client" for a reason (especially, row collapsing/expanding on Master row click (rows that contains child only)).
Here is the code:
Markup:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnRequestStart="mngRequestStarted" >                     <AjaxSettings>                                                  <telerik:AjaxSetting AjaxControlID="RadGrid3">                            <UpdatedControls>                                <telerik:AjaxUpdatedControl ControlID="RadGrid3" LoadingPanelID="RadAjaxLoadingPanel1" />                            </UpdatedControls>                        </telerik:AjaxSetting>                                             </AjaxSettings>                    </telerik:RadAjaxManager>                    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="WebBlue" />                   <telerik:RadToolTipManager runat="server" AnimationDuration="300" ShowDelay="600" HideDelay="1" ID="RadToolTipManager1" Width="480px" Height="227px"                   RelativeTo="Element" Animation="Slide" Position="MiddleRight" OnAjaxUpdate="RadToolTipManager_OnAjaxUpdate" Skin="WebBlue">                    </telerik:RadToolTipManager> <telerik:RadGrid ID="RadGrid3" runat="server" PageSize="20" AllowPaging="false" Width="100%"                                AllowSorting="True" AllowFilteringByColumn="false" AllowMultiRowSelection="false"                                ShowGroupPanel="false" GridLines="None" ShowFooter="false" ShowHeader="true" GroupingEnabled="false"                                Skin="WebBlue" EnableHeaderContextAggregatesMenu="false" EnableHeaderContextMenu ="false"                                AutoGenerateColumns="false" EnableViewState="True"                                OnItemCommand="RadGrid3_OnItemCommand" OnDetailTableDataBind="RadGrid3_DetailTableDataBind" OnNeedDataSource="RadGrid3_NeedDataSource"                                OnItemDataBound="RadGrid3_OnItemDataBound" OnGroupsChanging="RadGrid3_OnGroupsChanging" OnColumnsReorder="RadGrid3_OnColumnsReorder">                                                             <MasterTableView HierarchyLoadMode="Client" Name="Master"                                 CommandItemDisplay="Top" CommandItemSettings-ShowAddNewRecordButton="false"                                 CommandItemSettings-ShowExportToExcelButton="true" CommandItemSettings-ShowExportToWordButton="true"                                 CommandItemSettings-ShowExportToPdfButton="true" CommandItemSettings-ShowExportToCsvButton="true" AllowMultiColumnSorting="true"                                 Caption="">                                                                       <Columns>                                            <telerik:GridTemplateColumn HeaderText="Col1" UniqueName="str1Value" HeaderStyle-Width="50%" Resizable="true" Reorderable="true" SortExpression="str1Value">                                                <ItemTemplate>                                                  <%# Eval("str1Value")%>                                                </ItemTemplate>                                            </telerik:GridTemplateColumn>                                            <telerik:GridTemplateColumn HeaderText="Col2" UniqueName="str2Value" HeaderStyle-Width="50%" Resizable="true" Reorderable="true" SortExpression="str2Value">                                                <ItemTemplate>                                                  <%# Eval("str2Value")%>                                                </ItemTemplate>                                            </telerik:GridTemplateColumn>                                                                              </Columns>                                              <DetailTables>                                                <telerik:GridTableView ShowHeader="false" Name="Detail">                                                    <Columns>                                                        <telerik:GridTemplateColumn HeaderText="" UniqueName="strField" HeaderStyle-Width="25%" ItemStyle-CssClass="GridFieldColumn" Resizable="true" Reorderable="true">                                                            <ItemTemplate>                                                              <%# Eval("strField")%>                                                            </ItemTemplate>                                                        </telerik:GridTemplateColumn>                                                        <telerik:GridTemplateColumn HeaderText="" UniqueName="strValue" HeaderStyle-Width="75%" Resizable="true" Reorderable="true">                                                            <ItemTemplate>                                                              <%# Eval("strValue")%>                                                              <asp:HyperLink ID="hl" Target="_blank" runat="server" Text='<%# Eval("strLinkResource")%>' NavigateUrl='<%# Eval("strLinkValue")%>'></asp:HyperLink>                                                            </ItemTemplate>                                                        </telerik:GridTemplateColumn>                                                    </Columns>                                                   </telerik:GridTableView>                                            </DetailTables>                                </MasterTableView>                                <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>                                        <ClientSettings EnablePostBackOnRowClick="False" AllowRowsDragDrop="false" AllowDragToGroup="false" AllowColumnsReorder="false" ReorderColumnsOnClient="false" ColumnsReorderMethod="Reorder">                                            <Resizing AllowRowResize="False" EnableRealTimeResize="True" ResizeGridOnColumnResize="false" AllowColumnResize="true" AllowResizeToFit="true"/>                                            <Animation AllowColumnReorderAnimation="false" AllowColumnRevertAnimation="true" />                                            <Selecting AllowRowSelect="true"  />                                            <ClientEvents OnRowClick="OnRowClick"></ClientEvents>                                        </ClientSettings>                                        <SortingSettings SortedBackColor="Azure" EnableSkinSortStyles="false" />                                <GroupingSettings ShowUnGroupButton="true" />                            </telerik:RadGrid>Javascript:
function mngRequestStarted(ajaxManager, eventArgs) {    if (eventArgs.get_eventTarget().indexOf("ExportToExcelButton") != -1)  {         eventArgs.set_enableAjax(false);    }    if (eventArgs.get_eventTarget().indexOf("ExportToWordButton") != -1) {         eventArgs.set_enableAjax(false);    }    if (eventArgs.get_eventTarget().indexOf("ExportToPdfButton") != -1) {         eventArgs.set_enableAjax(false);    }    if (eventArgs.get_eventTarget().indexOf("ExportToCsvButton") != -1) {         eventArgs.set_enableAjax(false);    }}function OnRowClick(sender, args) {    var tableView = args.get_tableView();    if (tableView.get_name() == "Master") {        //getting child row count...this doesnt work when HierarchyLoadMode != "Client"        var detailTable = args.get_gridDataItem().get_nestedViews()[0];        if (detailTable.get_dataItems().length > 0) {                     tableView.clearSelectedItems();            args.get_item().set_expanded(!args.get_item().get_expanded());                     }    }}Code-Behind:
protected void RadGrid3_OnItemCommand(object o, Telerik.Web.UI.GridCommandEventArgs e){    if (e.CommandName == "RebindGrid")    {        RebindGrid(ref RadGrid3, true);    }    else    {        if (e.CommandName == "ExpandOrCollapse")        {            GridDataItem dataItem = RadGrid3.MasterTableView.Items[int.Parse(e.CommandArgument.ToString())] as GridDataItem;            dataItem.Expanded = !dataItem.Expanded;            return;        }          RebindGrid(ref RadGrid3, true);    }}protected void RadGrid3_OnColumnsReorder(object o, Telerik.Web.UI.GridColumnsReorderEventArgs e){      RebindGrid(ref RadGrid3, true);}protected void RadGrid3_OnGroupsChanging(object o, Telerik.Web.UI.GridGroupsChangingEventArgs e){      RebindGrid(ref RadGrid3, true);}protected void RadGrid3_NeedDataSource(object sender, GridNeedDataSourceEventArgs e){            BLL b = new BLL();            RadGrid3.DataSource = b.GetData();                 if (RadGrid3.DataSource == null)        {            RadGrid3.DataSource = new string[] { };        }     }protected void RadGrid3_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e){    if (e.DetailTableView.ParentItem.DataItem != null)    {        e.DetailTableView.DataSource = ((ParentDTO)e.DetailTableView.ParentItem.DataItem).colDetails;    }}protected void RadGrid3_OnItemDataBound(object sender, GridItemEventArgs e){    if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "Detail")    {        Control HyperLink = e.Item.FindControl("hl");              if (((DetailsDTO)e.Item.DataItem).strLinkValue != "" && ((DetailsDTO)e.Item.DataItem).blnIsImage)        {            this.RadToolTipManager1.TargetControls.Add(HyperLink.ClientID, ((DetailsDTO)e.Item.DataItem).strLinkValue, true);        }    }}
protected void RadToolTipManager_OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
        {
           UpdateToolTip(args.Value, args.UpdatePanel, Page);
        }
public void UpdateToolTip(string strVal, UpdatePanel panel, System.Web.UI.Page pg)
        {
            Control ctrl = pg.LoadControl("TooltipContainer.ascx");
            panel.ContentTemplateContainer.Controls.Add(ctrl);
            TooltipContainer details = (TooltipContainer)ctrl;
            if (strVal != "")
            {
                details.SetImage(strVal);
            }
        } TooltipContainer markup:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TooltipContainer.ascx.cs" Inherits="TooltipContainer" %><%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><asp:Image runat="server" ID="TooltipImage" AlternateText="" Height="100%" Width="100%" BorderWidth="0"></asp:Image>TooltipContainer Code-Behind (GetUrl function code omitted):
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using PL.BasePL;    public partial class TooltipContainer : System.Web.UI.UserControl    {                protected void Page_Load(object sender, EventArgs e)        {                  }        public void SetImage(string strPath)        {                      TooltipImage.ImageUrl = GetUrl(strPath);                 }             }TIA