Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
199 views
I have a RadGrid and I need to add a button to clear all filters. I found the option to use CommandItem however the it does not work. I got an error "The script tag registered for type 'System.Web.UI.Page' and key has invalid characters outside of the script tags:".

My RadGrid is popupated with an 'OnNeedDataSource="RadGrid1_NeedDataSource" '. Do I need to give functionality to the refresh button? If so how can I set the functionality to the refresh button?
Eyup
Telerik team
 answered on 20 Feb 2014
5 answers
118 views

IE 9 appears to be hitting max CSS files limit (32) when I open the Image Manger from the Editor.  According to the network trace the Image Manger Dialog loads 35 css files.  The result is that Image Manger is partially unstyled (tab styles missing in particular). FF, Chome are fine of course. 

I'm using the RadStyleSheetManager but it cannot combine the files because I'm using the CDN.  Is the combination of ImageManger, CDN, and IE just not expected to work?  Is there some workaround at would allow me to use the CDN? 

<telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" CdnSettings-TelerikCdn="Enabled" />

Files loaded in iframe when opening the Image Manger dialog:
1 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/FormDecorator.css GET 304 
2 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/FormDecorator.Default.css GET 304 
3 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Widgets.css GET 304 text/css 
4 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/Widgets.Default.css GET 304 
5 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/FileExplorer.css GET 304 
6 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/FileExplorer.Default.css GET 304 
7 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Window.css GET 304 
8 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/Window.Default.css GET 304 
9 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Menu.css GET 304 
10 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/Menu.Default.css GET 304 
11 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/ToolBar.css GET 304 
12 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/ToolBar.Default.css GET 304 
13 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/ToolTip.css GET 304 
14 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/ToolTip.Default.css GET 304 
15 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Ajax.css GET 304 
16 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/Ajax.Default.css GET 304 
17 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Splitter.css GET 304 
18 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/Splitter.Default.css GET 304 
19 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/TreeView.css GET 304 
20 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/TreeView.Default.css GET 304 
21 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Grid.css GET 304 
22 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/Grid.Default.css GET 304 
23 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Slider.css GET 304 
24 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/Slider.Default.css GET 304 
25 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/ListView.css GET 304 
26 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/ListView.Default.css GET 304 
27 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Upload.css GET 304 
28 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/Upload.Default.css GET 304 
29 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Button.css GET 304 
30 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/Button.Default.css GET 304 
31 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/MultiPage.css GET 304 
32 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Editor.css GET 304 
33 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/Editor.Default.css GET 304 
34 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/TabStrip.css GET 304 
35 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/TabStrip.Default.css GET 304

Edit:
Since this was working in our previous version of telerik (2012.2.724) I compared the CSS files loaded from that version.  2012.2.724 loaded 31 CSS files, so just within the limit for IE.  2013.1.220 has 4 additional files:

13 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/ToolTip.css GET 304
14 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/ToolTip.Default.css GET 304
21 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Grid.css GET 304
22 http://aspnet-skins.telerikstatic.com/ajaxz/2013.1.220/Default/Grid.Default.css GET 304

So my guess is that controls were added to the dialogs which added CSS files, pushing the number too high.  Telerik, if this is indeed the case, maybe you could prebundle the CSS files for a dialog into a single file?

Danail Vasilev
Telerik team
 answered on 20 Feb 2014
1 answer
92 views
hey everyone
i am using RadAsyncUpload. i just to know how to file auto selected on page load in
radasyncupload. how to do this.. ? Any one please help me
Shinu
Top achievements
Rank 2
 answered on 20 Feb 2014
1 answer
55 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
178 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
90 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
107 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
298 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
185 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.4K+ 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?