Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
41 views
Very strange issue with the rad editor.  I've got a Dotnetnuke site that I've replaced the default telerik controls with my own personal license.  The current installed version is 2013.3.1324.40.  This issue only occurs in firefox.

If the html in the editor doesn't start with a div tag then I can't use the image manager.  It doesn't let me upload or browse.  If I change the content to start with an empty div then I can use the editor again.  Any ideas on this weird issue?
Slav
Telerik team
 answered on 20 Feb 2014
5 answers
155 views
Hi All ,
         I have two detail Tables in my RadGrid . when I am exporting it in excel the bad image of paging icons are also getting exported in excel.
        these bad images are exporting only for those child grids which have data in it.  please let me know what I am doing wrong.  my code behind code is

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/.master" AutoEventWireup="true"
    CodeFile="Sample.aspx.cs" Inherits="Sample" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder_Content" runat="Server">
    <script type="text/javascript">

        
        //To refresh domains and roles grid
        function RefreshSampleRadGrid() {
            var radMgr = $find('<%=RadAjaxManager.GetCurrent(Page).ClientID %>');
            radMgr.ajaxRequest("SampleRadGrid");
            return false;
        }
        
        function DisableAjax(eventTarget, eventArgument) {

            $find('<%=RadAjaxManager.GetCurrent(Page).ClientID %>').__doPostBack(eventTarget, eventArgument);
        }
    </script>
    <telerik:RadSplitter ID="SampleRadSplitter" runat="server">
        <telerik:RadPane ID="TopRadPane" runat="server" SkinID="TopRadPane">
        </telerik:RadPane>
        <telerik:RadSplitBar ID="ProfileRadSplitBar" runat="server" />
        <telerik:RadPane ID="SampleRadPane" runat="server" SkinID="BottomRadPane">
            <telerik:RadDockLayout ID="SampleRadDockLayout" runat="server" OnLoadDockLayout="SampleRadDockLayout_LoadDockLayout">
                <asp:Label ID="MessageLabel" runat="server" Visible="false" SkinID="MessageLabel"></asp:Label>
                <telerik:RadDockZone BorderStyle="None" ID="SampleRadDockZone" runat="server">
                    <telerik:RadDock ID="SampleRadDock" runat="server" OnCommand="RadDock_Command">
                        <TitlebarTemplate>
                            <table class="RadDockTitlebarTemplateTableClass">
                                <tr>
                                    <td>
                                        <asp:Label ID="ConfigurationFileLabel" runat="server" Text="Configuration File"
                                            SkinID="RadDockTitleLabel" />
                                    </td>
                                    <td>
                                        <asp:LinkButton ID="RemoveLinkButton" runat="server" Text="Clear Selected" SkinID="SmallLinkButton"
                                            OnClick="RemoveLinkButton_Click"></asp:LinkButton>
                                    </td>
                                </tr>
                            </table>
                        </TitlebarTemplate>
                        <ContentTemplate>
                            <div class="RadGridHorizontalScroll">
                                <telerik:RadGrid ID="SampleRadGrid" OnPreRender="SampleRadGrid_PreRender" OnNeedDataSource="SampleRadGrid_NeedDataSource"
                                    runat="server" Width="99.4%" OnDetailTableDataBind="SampleRadGrid_DetailTableDataBind"
                                    OnItemDataBound="SampleRadGrid_ItemDataBound" OnItemCreated="SampleRadGrid_ItemCreated"
                                    OnPageIndexChanged="SampleRadGrid_PageIndexChanged">
                                    <ClientSettings>
                                        <Resizing AllowColumnResize="true" EnableRealTimeResize="true" ResizeGridOnColumnResize="true"
                                            ClipCellContentOnResize="true" />
                                    </ClientSettings>
                                    <MasterTableView DataKeyNames="userID,userName" HierarchyLoadMode="Client"
                                        HierarchyDefaultExpanded="false" TableLayout="Fixed" CommandItemDisplay="Top">
                                        <CommandItemTemplate>
                                            <table width="100%">
                                                <tr>
                                                    <td></td>
                                                    <td class="ExportButtonIconSaperator">
                                                        <asp:ImageButton ID="ExportToExcelImageButton" SkinID="ExportToExcelImageButtonSkin"
                                                            runat="server" OnClick="ExportToExcelImageButton_Click" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </CommandItemTemplate>

                                        <Columns>
                                            <telerik:GridBoundColumn SortExpression="userName" HeaderText="user" HeaderButtonType="TextButton"
                                                DataField="userName">
                                                <%-- Defect# 12711--%>
                                            </telerik:GridBoundColumn>
                                        </Columns>
                                        <DetailTables>
                                            <telerik:GridTableView DataKeyNames="ConfigurationID,userID" GridLines="None" HierarchyLoadMode="Client" HierarchyDefaultExpanded="true">
                                                <PagerStyle Visible="false" />
                                                <ParentTableRelation>
                                                    <telerik:GridRelationFields DetailKeyField="userID" MasterKeyField="userID" />
                                                </ParentTableRelation>
                                                <Columns>
                                                    <telerik:GridBoundColumn DataField="ConfigurationDesc" HeaderText="Configuration Name"
                                                        UniqueName="ConfigurationDesc">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="user" HeaderText="user" UniqueName="user">
                                                        <%-- Defect# 12711--%>
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="FixedColumn" HeaderText="Fixed Column" UniqueName="FixedColumn">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="meter" HeaderText="meter" UniqueName="meter">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="Type" HeaderText="Code"
                                                        UniqueName="DisbursementType">
                                                    </telerik:GridBoundColumn>
                                                </Columns>
                                                <DetailTables>
                                                    <telerik:GridTableView DataKeyNames="ID,userID" Width="100%" GridLines="None"
                                                        HierarchyLoadMode="Client" AllowCustomPaging="true">
                                                        <ParentTableRelation>
                                                            <telerik:GridRelationFields DetailKeyField="userID" MasterKeyField="userID" />
                                                        </ParentTableRelation>
                                                        <Columns>
                                                            <telerik:GridTemplateColumn UniqueName="SelectItemCheckBoxColumn" Resizable="false" Reorderable="false">
                                                                <ItemTemplate>
                                                                    <asp:CheckBox ID="SelectItemCheckBox" runat="server" onclick="return CheckItem(this);" />
                                                                </ItemTemplate>
                                                                <HeaderTemplate>
                                                                    <asp:CheckBox ID="SelectHeaderCheckBox" runat="server" onclick="CheckAll(this);" />
                                                                </HeaderTemplate>
                                                            </telerik:GridTemplateColumn>
                                                            <telerik:GridTemplateColumn HeaderText="Action" UniqueName="TemplateColumn" Resizable="false" Reorderable="false">
                                                                <ItemTemplate>
                                                                    <asp:HyperLink ID="EditHyperLink" runat="server" Text="Edit" SkinID="SmallHyperLink"></asp:HyperLink>
                                                                </ItemTemplate>
                                                                <HeaderStyle Width="5%" />
                                                            </telerik:GridTemplateColumn>
                                                            <telerik:GridBoundColumn DataField="UniqueNumber" HeaderText="Unique Number"
                                                                UniqueName="UniqueNumber" SortExpression="UniqueNumber">
                                                                <HeaderStyle Width="10%" />
                                                            </telerik:GridBoundColumn>
                                                            <telerik:GridBoundColumn DataField="Number" HeaderText="Number" UniqueName="Number"
                                                                SortExpression="Number">
                                                            </telerik:GridBoundColumn>
                                                            <telerik:GridBoundColumn DataField="com" HeaderText="com" UniqueName="com"
                                                                SortExpression="com">
                                                                <HeaderStyle Width="10%" />
                                                            </telerik:GridBoundColumn>
                                                            <telerik:GridBoundColumn DataField="Date/Time" HeaderText="Date/Time" UniqueName="Date/Time"
                                                                SortExpression="Date/Time">
                                                                <HeaderStyle Width="10%" />
                                                            </telerik:GridBoundColumn>
                                                            <telerik:GridBoundColumn DataField="com" HeaderText=" com" UniqueName="com" SortExpression="com">
                                                                <%-- Defect# 12711--%>
                                                            </telerik:GridBoundColumn>
                                                            <telerik:GridBoundColumn DataField="Pump" HeaderText=" Dispenser" UniqueName="Pump" SortExpression="Pump">
                                                                <%-- Defect# 12711--%>
                                                            </telerik:GridBoundColumn>
                                                            <telerik:GridBoundColumn DataField="Type" HeaderText=" Type" UniqueName="Type"
                                                                SortExpression="Type">
                                                            </telerik:GridBoundColumn>
                                                            <telerik:GridBoundColumn DataField="Quantity" HeaderText="Quantity" UniqueName="Quantity"
                                                                SortExpression="Quantity">
                                                            </telerik:GridBoundColumn>
                                                            <telerik:GridBoundColumn DataField="Cost" HeaderText="Cost" UniqueName="Cost" SortExpression="Cost">
                                                            <telerik:GridBoundColumn DataField="ErrorDescription" HeaderText="Error Description"
                                                                UniqueName="ErrorDescription" SortExpression="ErrorDescription">
                                                                <HeaderStyle Width="20%" />
                                                            </telerik:GridBoundColumn>
                                                        </Columns>
                                                    </telerik:GridTableView>
                                                </DetailTables>
                                            </telerik:GridTableView>
                                        </DetailTables>
                                    </MasterTableView>
                                </telerik:RadGrid>
                            </div>
                        </ContentTemplate>
                        <Commands>
                            <telerik:DockCommand Text="Save Position" AutoPostBack="true" />
                            <telerik:DockExpandCollapseCommand />
                        </Commands>
                    </telerik:RadDock>
                </telerik:RadDockZone>
            </telerik:RadDockLayout>
            <telerik:RadWindowManager ID="RadWindowManager" runat="server">
                <Windows>
                    <telerik:RadWindow ID="EditDialog" Title=" Transactions"
                        Left="150px" runat="server" />
                    <telerik:RadWindow ID="ErrorDialog" Title="Process Errors" Left="150px" runat="server"></telerik:RadWindow>
                </Windows>
            </telerik:RadWindowManager>
        </telerik:RadPane>
    </telerik:RadSplitter>
</asp:Content>





public partial class Sample 
{
   #region Events

    protected void Page_Load(object sender, EventArgs e)
    {
        TitleSetHelper.Instance.SetHeaderText(sampleRadGrid);
        ValidateCredentials(FuelPermission.Check(SecurityAttribute.FuelPerm.FuelTransactionImport), false);
        RadAjaxManager radAjaxManager = Master.FindControl("RadAjaxManagerFuel") as RadAjaxManager;
        if (radAjaxManager != null)
        {
            radAjaxManager.AjaxSettings.AddAjaxSetting(radAjaxManager, sampleRadGrid);
            radAjaxManager.AjaxSettings.AddAjaxSetting(sampleRadGrid, sampleRadGrid);
            radAjaxManager.AjaxSettings.AddAjaxSetting(radAjaxManager, RemoveLinkButton);
            radAjaxManager.AjaxSettings.AddAjaxSetting(sampleRadGrid, RemoveLinkButton);
            radAjaxManager.AjaxSettings.AddAjaxSetting(sampleRadGrid, MessageLabel);
            radAjaxManager.AjaxSettings.AddAjaxSetting(RemoveLinkButton, MessageLabel);
        }
        
    }

    protected void Page_Init(object sender, EventArgs e)
    {
        AddCustomPager(sampleRadGrid);
        GridTableView gridTableView = sampleRadGrid.MasterTableView.DetailTables[0].DetailTables[0];
        if (gridTableView != null)
        {
            gridTableView.AllowPaging = true;
            gridTableView.PagerStyle.AlwaysVisible = true;
        }
       
    }


    protected void sampleRadGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        try
        {
            userInfoList userInfoList = userInfoList.GetInfoList("user", (Int32)userStatus.Active);
            DataTable dataTable = new DataTable("userInfoListData");
            dataTable.Columns.Add(new DataColumn("userID", Type.GetType("System.Int32")));
            dataTable.Columns.Add(new DataColumn("userName", Type.GetType("System.String")));

            foreach (userInfo userInfo in userInfoList)
            {
                DataRow dataRow = dataTable.NewRow();
                dataRow["userID"] = userInfo.userID;
                dataRow["userName"] = userInfo.userName;
                dataTable.Rows.Add(dataRow);
            }
            sampleRadGrid.DataSource = dataTable;
        }
        catch (Exception ex)
        {
            FasterExceptionHandler.Instance.HandleException(ex, ExceptionResources.userInfoListGet, MessageLabel, null);
        }
        if (Cacheobject[String.Format("GridPageIndex{0}", _guid)] != null)
            sampleRadGrid.CurrentPageIndex = (Int32)Cacheobject[String.Format("GridPageIndex{0}", _guid)];
    }

    protected void sampleRadGrid_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
    {
       
        
        Cacheobject.Remove(String.Format("IDList{0}", _guid));
        //if (Cacheobject[String.Format("user{0}", _guid)] != null)
        Cacheobject.Remove(String.Format("user{0}", _guid));
        //if (Cacheobject[String.Format("GridPageIndex{0}", _guid)] != null)
        Cacheobject.Remove(String.Format("GridPageIndex{0}", _guid));
        List<Int32> transactionIDList = new List<Int32>();
        Int32 userID = 0;
        Int32 ConfigurationID = 0;
        String userName = String.Empty;
        GridDataItem dataItem = e.DetailTableView.ParentItem;
        userID = Convert.ToInt32(dataItem.GetDataKeyValue("userID"));
        AddCache(String.Format("user{0}", _guid), userID);
        userName = Convert.ToString(dataItem.GetDataKeyValue("userName"));
        ConfigurationID = Convert.ToInt32(dataItem.GetDataKeyValue("ConfigurationID"));
        DataSet dataSet = new DataSet();

        if (ConfigurationID == 0)
        {
            try
            {
                sampleRadGrid.VirtualItemCount = InfoList.GetTotalRecords(userID);
            }
           
            catch (Exception ex)
            {
                ExceptionHandler.Instance.HandleException(ex, ExceptionResources.InfoList, MessageLabel, null, "userID: " + userID);
            }

      

            DataTable dataTable = new DataTable("Configuration");
            dataTable.Columns.Add(new DataColumn("ConfigurationID", System.Type.GetType("System.Int32")));
            dataTable.Columns.Add(new DataColumn("userID", System.Type.GetType("System.Int32")));
            dataTable.Columns.Add(new DataColumn("ConfigurationDesc", System.Type.GetType("System.String")));
            dataTable.Columns.Add(new DataColumn("user", System.Type.GetType("System.String")));
            dataTable.Columns.Add(new DataColumn("FixedColumn", System.Type.GetType("System.String")));
            dataTable.Columns.Add(new DataColumn("meter", System.Type.GetType("System.String")));
            dataTable.Columns.Add(new DataColumn("Type", System.Type.GetType("System.String")));
            ConfigurationInfo ConfigurationInfo = null;
            try
            {
                ConfigurationInfo = ConfigurationInfo.GetInfo(null, userID);
            }
          
            catch (Exception ex)
            {
                FasterExceptionHandler.Instance.HandleException(ex, ExceptionResources.ConfigurationInfoGet, MessageLabel, null);
            }

            if (ConfigurationInfo != null)
            {
                DataRow row = dataTable.NewRow();
                row["ConfigurationID"] = ConfigurationInfo.ConfigurationID;
                row["userID"] = ConfigurationInfo.userID;
                row["ConfigurationDesc"] = ConfigurationInfo.ConfigurationDesc;
                row["user"] = userName;
                row["FixedColumn"] = ConfigurationInfo.IsColumnFixed ? "Yes" : "No";
                try
                {
                    row["meter"] = ConfigurationInfo.DelimeterID == null ? String.Empty : STLImportConfigurationDelimeterInfo.GetInfo(Convert.ToInt32(ConfigurationInfo.DelimeterID)).DelimeterDesc;
                }
              
                catch (Exception ex)
                {
                    FasterExceptionHandler.Instance.HandleException(ex, ExceptionResources.ImportConfigurationDelimeterGet, MessageLabel, null);
                }
                try
                {
                    row["Type"] = ConfigurationInfo.DisbursementID == null ? String.Empty : STLDisbursementInfo.GetInfo(Convert.ToInt32(ConfigurationInfo.DisbursementID)).DisbursementDesc;
                }
                //Updated by CB for Feature# 2575
                catch (Exception ex)
                {
                    FasterExceptionHandler.Instance.HandleException(ex, ExceptionResources.STLDisbursementInfoGet, MessageLabel, null);
                }
                dataTable.Rows.Add(row);
            }
            dataSet.Merge(dataTable);

           
        }
        else
        {
            #region Processing Errors Grid

            DataTable tempDataTable = new DataTable("tempDataTable");
            tempDataTable.Columns.Add(new DataColumn("TransactionID", Type.GetType("System.Int32")));
            tempDataTable.Columns.Add(new DataColumn("userID", Type.GetType("System.Int32")));
            tempDataTable.Columns.Add(new DataColumn("TransactionNumber", Type.GetType("System.String")));
            tempDataTable.Columns.Add(new DataColumn("AssetNumber", Type.GetType("System.String")));
            tempDataTable.Columns.Add(new DataColumn("Organization", Type.GetType("System.String")));
            tempDataTable.Columns.Add(new DataColumn("Date/Time", Type.GetType("System.String")));
            tempDataTable.Columns.Add(new DataColumn("Site", Type.GetType("System.String")));
            tempDataTable.Columns.Add(new DataColumn("Pump", Type.GetType("System.String")));
            tempDataTable.Columns.Add(new DataColumn("FuelType", Type.GetType("System.String")));
            tempDataTable.Columns.Add(new DataColumn("Quantity", Type.GetType("System.String")));
            tempDataTable.Columns.Add(new DataColumn("ErrorDescription", Type.GetType("System.String")));
            //To get sort expression.
            System.Text.StringBuilder sortExpression = new System.Text.StringBuilder();
            foreach (GridSortExpression gridSortExpression in sampleRadGrid.MasterTableView.SortExpressions)
            {
                sortExpression.Append(gridSortExpression.FieldName);
                if (gridSortExpression.SortOrder == GridSortOrder.Descending)
                    sortExpression.Append(" Desc");
                else
                    sortExpression.Append(" Asc");
                sortExpression.Append(",");
            }
            try
            {
                if (Cacheobject[String.Format("DetailTablePageIndex{0}", _guid)] != null && Cacheobject[String.Format("IsPageIndexChanged{0}", _guid)] != null)
                {
                    e.DetailTableView.CurrentPageIndex = (Int32)Cacheobject[String.Format("DetailTablePageIndex{0}", _guid)];
                    Cacheobject.Remove(String.Format("IsPageIndexChanged{0}", _guid));
                }
                if (Cacheobject[String.Format("PageSize{0}", _guid)] != null)
                {
                    e.DetailTableView.PageSize = (Int32)Cacheobject[String.Format("PageSize{0}", _guid)];
                    Cacheobject.Remove(String.Format("PageSize{0}", _guid));
                }
                InfoList InfoList = InfoList.GetInfoList(userID, e.DetailTableView.CurrentPageIndex + 1, e.DetailTableView.PageSize, sortExpression.ToString());
                _pageSize = e.DetailTableView.PageSize;
                _sortExpression = sortExpression.ToString();
                foreach (TempFuelTransactionInfo tempFuelTransaction in InfoList)
                {
                    if (IDList.Count < e.DetailTableView.PageSize)
                    {
                        String site = String.Empty;
                        String pump = String.Empty;
                        String errorDescription = String.Empty;
                        String billCode = String.Empty;
                        DataRow Row = tempDataTable.NewRow();
                        Row["TransactionID"] = temp.ID;
                        Row["userID"] = tempFuelTransaction.userID;
                        Row["TransactionNumber"] = tempFuelTransaction.TransactionNumber;
                        Row["Organization"] = tempFuelTransaction.Organization;
                        if (!String.IsNullOrEmpty(tempFuelTransaction.TransactionDate))
                            Row["Date/Time"] = Convert.ToDateTime(tempFuelTransaction.TransactionDate).ToString("MM/dd/yyyy HH:mm:sss");
                        _transactionID = tempFuelTransaction.TransactionID;
                        Boolean isError = false;
                        String rejectedRecordBits = tempFuelTransaction.RejectedRecordsBitsString;

                 IDList.Add(tempFuelTransaction.TransactionID);
                }
                AddSlidingCache(String.Format("IDList{0}", _guid), transactionIDList);
                AddSlidingCache(String.Format("GridPageIndex{0}", _guid), sampleRadGrid.CurrentPageIndex);
                AddSlidingCache(String.Format("DetailTablePageIndex{0}", _guid), e.DetailTableView.CurrentPageIndex);
            }
            
            catch (Exception ex)
            {
                FasterExceptionHandler.Instance.HandleException(ex, ExceptionResources.TempFuelTransactionInfoGet, MessageLabel, null);
            }
            dataSet.Merge(tempDataTable);

            #endregion
        }
        e.DetailTableView.DataSource = dataSet;
    }

    protected void sampleRadGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            HyperLink editHyperLink = e.Item.FindControl("EditHyperLink") as HyperLink;
            if (editHyperLink != null)
            {
                GridDataItem dataItem = e.Item as GridDataItem;
                string checkSite = dataItem["Site"].Text;
                //String formatting off of data item
                //<Font color=red></font>
                if (checkSite.Contains(@"<Font color=red>"))
                    checkSite = checkSite.Replace(@"<Font color=red>", "");
                if (checkSite.Contains(@"</Font>"))
                    checkSite = checkSite.Replace(@"</Font>", "");
                if (checkSite.Contains(_errorImagePath))
                    checkSite = checkSite.Replace(_errorImagePath, "");

               
            }
        }
    }
    protected void sampleRadGrid_PreRender(object sender, EventArgs e)
    {
        Boolean hasRecords = false;
        if (sampleRadGrid.MasterTableView.Items.Count > 0)
        {
            foreach (GridDataItem dataItem in sampleRadGrid.MasterTableView.Items)
            {

                foreach (GridDataItem nestedDataItem in dataItem.ChildItem.NestedTableViews[0].Items)
                {

                    if (!hasRecords && nestedDataItem.ChildItem.NestedTableViews[0].Items.Count > 0)
                    {
                        hasRecords = true;
                        break;
                    }
                }
                if (hasRecords)
                    break;

            }
        }
        RemoveLinkButton.Enabled = hasRecords;
        
    }

    protected void RemoveLinkButton_Click(object sender, EventArgs e)
    {
        String cacheName = String.Format("TempTransactionID{0}", _guid);
        if (Cacheobject[cacheName] != null)
        {
            Cacheobject.Remove(cacheName);
        }
        MessageLabel.Visible = false;
        List<Int32> transactionIDList = new List<Int32>();
        foreach (GridDataItem gridDataItem in sampleRadGrid.Items)
        {
            CheckBox processErrorcheckBox = gridDataItem.FindControl("SelectItemCheckBox") as CheckBox;
            if (processErrorcheckBox != null && processErrorcheckBox.Checked)
            {
                Int32 ID = 0;
                Int32.TryParse(Convert.ToString(gridDataItem.GetDataKeyValue("ID")), out ID);
                transactionIDList.Add(ID);
            }
        }
       
       
    }
    protected void ExportToExcelImageButton_Click(object sender, EventArgs e)
    {
        ExportDataToFile();
        ExportToExcel(sampleRadGrid, "sampleResults", false, String.Empty);
    }
    protected void Page_PreRender(object sender, System.EventArgs e)
    {
        GridItem commandItem = sampleRadGrid.MasterTableView.GetItems(GridItemType.CommandItem)[0];
        ImageButton exportToExcelImageButton = commandItem.FindControl("ExportToExcelImageButton") as ImageButton;
        Boolean isGridHasData = sampleRadGrid.Items.Count > 0;
        if (exportToExcelImageButton != null)
        {
            exportToExcelImageButton.Enabled = isGridHasData;
            if (exportToExcelImageButton.Enabled)
            {
                exportToExcelImageButton.Attributes.Add("onclick", String.Format("DisableAjax(\"{0}\", \"\"); return false;", exportToExcelImageButton.UniqueID));
                exportToExcelImageButton.Style.Add(StringResources.CssCursorKey, StringResources.CssCursorValue);
            }
        }
    }
    private userFuelSiteInfo userFuelSiteGet(string checkSite, int userID)
    {
        userFuelSiteInfo userFuelSiteInfo = null;

        try
        {
            userFuelSiteInfo = userFuelSiteInfo.GetInfo(checkSite, userID);
        }
        //Updated by CB for Feature# 2575
        catch (Exception ex)
        {
            FasterExceptionHandler.Instance.HandleException(ex, ExceptionResources.userFuelSiteInfoGet, MessageLabel, null, "userID:" + userID.ToString() + "userFuelSite:" + checkSite);
        }
        return userFuelSiteInfo;
    }

    protected void sampleRadGrid_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            if (Cacheobject[String.Format("user{0}", _guid)] != null && e.Item.OwnerTableView.HierarchyDefaultExpanded)
            {
                if (Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["userID"]) == (Int32)Cacheobject[String.Format("user{0}", _guid)])
                    e.Item.OwnerTableView.HierarchyDefaultExpanded = true;
                else
                    e.Item.OwnerTableView.HierarchyDefaultExpanded = false;
            }
        }
    }

    protected void sampleRadGrid_PageIndexChanged(object source, GridPageChangedEventArgs e)
    {
        e.Item.OwnerTableView.CurrentPageIndex = e.NewPageIndex;
        AddSlidingCache(String.Format("GridPageIndex{0}", _guid), sampleRadGrid.CurrentPageIndex);
        Cacheobject.Remove(String.Format("DetailTablePageIndex{0}", _guid));
    }

    #endregion

    #region Class Functions
    /// <summary>
    /// Create Export Data
    /// </summary>
    private void ExportDataToFile()
    {
        sampleRadGrid.MasterTableView.ExpandCollapseColumn.Display = false;
        sampleRadGrid.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;
        sampleRadGrid.MasterTableView.DetailTables[0].ExpandCollapseColumn.Display = false;
        sampleRadGrid.MasterTableView.DetailTables[0].DetailTables[0].ExpandCollapseColumn.Display = false;
        sampleRadGrid.MasterTableView.DetailTables[0].DetailTables[0].ShowFooter  = false;
        sampleRadGrid.MasterTableView.DetailTables[0].DetailTables[0].ShowGroupFooter= false;
        sampleRadGrid.MasterTableView.DetailTables[0].DetailTables[0].PagerStyle.Visible  = false;
        sampleRadGrid.ExportSettings.IgnorePaging = true;
        sampleRadGrid.MasterTableView.DetailTables[0].DetailTables[0].AllowPaging = false;
        GridTemplateColumn templateColumn = sampleRadGrid.MasterTableView.DetailTables[0].DetailTables[0].Columns.FindByUniqueName("TemplateColumn") as GridTemplateColumn;
        if (templateColumn != null)
            templateColumn.Visible = false;
        GridTemplateColumn selectItemCheckBoxColumn = sampleRadGrid.MasterTableView.DetailTables[0].DetailTables[0].Columns.FindByUniqueName("SelectItemCheckBoxColumn") as GridTemplateColumn;
        if (selectItemCheckBoxColumn != null)
            selectItemCheckBoxColumn.Visible = false;
    }
    protected void ExportToExcel(RadGrid searchRadGrid, String fileName, Boolean isActionColumn, String columnUniqueName)
        {
            if (isActionColumn)
                searchRadGrid.MasterTableView.Columns.FindByUniqueName(columnUniqueName).Display = false;
            
            if (searchRadGrid.MasterTableView.HasDetailTables)
            {
                foreach (GridTableView gridTableView in searchRadGrid.MasterTableView.DetailTables)
                {
                    // Added by partner CB to Fix defect 15597 
                    gridTableView.AllowPaging = false;
                    gridTableView.HierarchyDefaultExpanded = true;
                }
            }
            searchRadGrid.ExcelExportCellFormatting += new OnExcelExportCellFormattingEventHandler(SearchRadGrid_ExcelExportCellFormatting);
            searchRadGrid.ItemCreated += new GridItemEventHandler(RadGrid_ItemCreated);
            searchRadGrid.ExportSettings.ExportOnlyData = true;
            searchRadGrid.ExportSettings.IgnorePaging = true;
            searchRadGrid.ExportSettings.OpenInNewWindow = true;
            searchRadGrid.ExportSettings.FileName = fileName;
            _isExport = true;
            searchRadGrid.MasterTableView.ExportToExcel();
        }
    #endregion
}
Thanks
Shubham
Top achievements
Rank 1
 answered on 20 Feb 2014
1 answer
62 views
Hi
im trying to use "All" option for my filter template RadComboBox. But its not displaying. Anyone knows why?
Shinu
Top achievements
Rank 2
 answered on 20 Feb 2014
1 answer
61 views
I have a rad grid inside a custom tab control, when we upgrade to new telerik version ( 2013.3.1324), it is not working as expected. If we click on the design tab of rad editor it is not enabling. 

Please help




Ianko
Telerik team
 answered on 20 Feb 2014
6 answers
256 views
I have a FooterTemplate inside a Template Column of RadGrid inside which i have a label, i am updating that label value in javascript 
<FooterTemplate>
     <asp:Label ID="lblFooterValue" Font-Bold="true"  ForeColor="Green" Font-Size="15px"
         runat="server"></asp:Label>
     </FooterTemplate>


After all i am exporting RadGrid to excel but that label value is not coming in footer.
As i have another Bound Column in which i am also showig footer that  column's footer value is exporting well.but not my template column.
where i am doing wrong pls correct me
Shubham
Top achievements
Rank 1
 answered on 20 Feb 2014
3 answers
165 views
hi
i have a radbutton:

<telerik:RadButton ID="btnRegisterOrder" runat="server" Height="65px"
                                                            Text="ثبت سفارش" Width="160px" Font-Size="Large"><Icon PrimaryIconUrl="images/iconIco/accept.ico"  /></telerik:RadButton>

and this button will updated in radajaxmanager:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
  <AjaxSettings>
                     <telerik:AjaxSetting AjaxControlID="btnAddToList">
              <UpdatedControls>
                  <telerik:AjaxUpdatedControl ControlID="RadFileExplorer2" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="imgfront"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="imgback"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="imgfrontfilm"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="imgbackfilm"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="hfClientFileSelectForNewOrder"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="hdnImg1"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="hdnImg2"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="hdnImg3"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="hdnImg4"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="RadGrid7"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="btnRegisterOrder"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="radnotification1"></telerik:AjaxUpdatedControl>
              </UpdatedControls>
               
          </telerik:AjaxSetting>
          <telerik:AjaxSetting AjaxControlID="radToolBarFilterInvoices">
              <UpdatedControls>
                   
                  <telerik:AjaxUpdatedControl ControlID="RadGrid3" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                  <telerik:AjaxUpdatedControl ControlID="RadWindow1"></telerik:AjaxUpdatedControl>
                              
              </UpdatedControls>
           
          </telerik:AjaxSetting>
          <telerik:AjaxSetting AjaxControlID="radgrid3">
              <UpdatedControls>
                   
                  <telerik:AjaxUpdatedControl ControlID="RadGrid3" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                              
              </UpdatedControls>
           
          </telerik:AjaxSetting>
           
      </AjaxSettings>
       
  </telerik:RadAjaxManager>

after update, the button not working.
Viktor Tachev
Telerik team
 answered on 20 Feb 2014
5 answers
1.3K+ views
C# .NET 3.5

Telerik.Web.UI, Version=2008.3.1125.35


I have a frequent need to be able to hide some columns in a grid on display, but have them available on export and hide others on export. Thus far I've had no luck in being able to do all three. The show on export of the columns we hide for display is the piece that's not working for me.

I have in the ItemCreated command the hide columns code

 
                // hide columns  
                string myColumnsToHide = myDatabaseAccess.v2_sp_application_configuration_matrix_get_value("manage_spoc_matrix""HideOnDisplayResults_RadGrid1");  
                foreach (Telerik.Web.UI.GridColumn myColumn in RadGrid1.MasterTableView.RenderColumns)  
                {  
                    if (myColumnsToHide.ToLower().Contains("|" + myColumn.UniqueName.ToLower() + "|"))  
                    {  
                        myColumn.Display = false;  
                    }  
                } 

and in the ItemCommand for the export piece the code to show the prev hidden columns then hide addional ones from the export

 
                    // show columns we hid for display  
                    string myColumnsToShow = myDatabaseAccess.v2_sp_application_configuration_matrix_get_value("manage_spoc_matrix""HideOnDisplayResults_RadGrid1");  
                    foreach (Telerik.Web.UI.GridColumn myColumn in RadGrid1.MasterTableView.RenderColumns)  
                    {  
                        if (myColumnsToShow.ToLower().Contains("|" + myColumn.UniqueName.ToLower() + "|"))  
                        {  
                            myColumn.Display = true;  
                        }  
                    }  
 
                    // then hide any coulmns we don't want on export  
                    string myColumnsToHide = myDatabaseAccess.v2_sp_application_configuration_matrix_get_value("manage_spoc_matrix""HideOnExport_RadGrid1");  
                    foreach (Telerik.Web.UI.GridColumn myColumn in RadGrid1.MasterTableView.RenderColumns)  
                    {  
                        if (myColumnsToHide.ToLower().Contains("|" + myColumn.UniqueName.ToLower() + "|"))  
                        {  
                            myColumn.Display = false;  
                        }  
                    } 

The hide on display works. The hide of the additional columns on export works. But I can't seem to show on export the columns we hid for display purposes. It seems the ItemCreated event is exercised multiple times (as far as I can tell 1x before and 2x after) when invoking the ItemCommand function.

Any suggestions on how to show on export the columns we want hidden on display?

Thanks!
Princy
Top achievements
Rank 2
 answered on 20 Feb 2014
3 answers
73 views
Hi there,

We use the RadRibbon control on a popup window (like when you select "new mail" in Office Outlook).

Some of the last menu groups are all the way to the right side of the popup, and when you hoover over them a tooltip is displayed.

But this tooltip is too wide, and causes the popup window to have scrollbars (when tooltip is visible)

Isnt it possible to have the tooltips align to the right or maybe even better - to align to til right side of the visible browser area as a maximum ?

It makes NO sense to have a tooltip, that is not readable as its outside of the visible browser area.

See the screenshot.


Cheers,
Tony Fonager
Boyan Dimitrov
Telerik team
 answered on 20 Feb 2014
1 answer
56 views
Hello,

I've noticed that pivot grid filter window displays relative to the pivot grid. I want to set the filter window on the center of the browser window. I've tried set_left,set_top client side functions with filter window OnClientShow event but it didn't work. Provide me with a code sample to achieve this. 

Thanks and Regards,
Yohan
Venelin
Telerik team
 answered on 20 Feb 2014
2 answers
39 views
Hi 

I am getting and exception "cannot order by type" after i try to sort my linq statement .

after this i populate it to a gridview.

var data = from d in db.TransactionMessages
                       where d.TransactionMessage1.Contains("POS - ") 
                       orderby d
                       select d.TransactionMessage1;

Grant
Grant
Top achievements
Rank 1
 answered on 20 Feb 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?