Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
533 views
On an export to Excel, I can't seem to find a way to suppress the header row.  I'm creating the grid programmatically.  Here's the relevant code:

RadGrid

exportGrid = new RadGrid();

 

exportGrid.NeedDataSource +=

new GridNeedDataSourceEventHandler( exportGrid_NeedDataSource );

 

exportGrid.Skin =

"Default";
exportGrid.Width =
Unit.Percentage( 100 );
exportGrid.ShowHeader =
false;
exportGrid.AutoGenerateColumns =
true;
exportGrid.ExportSettings.ExportOnlyData =
true;
exportGrid.ExportSettings.Excel.Format =
GridExcelExportFormat.ExcelML;
exportGrid.DataMember =
"ExportData";
PlaceHolder phExport = new PlaceHolder();
currentPage.Controls.Add( phExport );
exportGrid.DataSource = _exportData;
phExport.Controls.Add( exportGrid );
exportGrid.Rebind();

 

 

foreach ( GridHeaderItem headerItem in exportGrid.MasterTableView.GetItems( GridItemType.Header ) )
headerItem.Visible =
false;

 

exportGrid.MasterTableView.ExportToExcel();

I also tried a couple of different variations on this approach, without any luck:

 

protected

void exportGrid_ExcelMLExportRowCreated( object source, Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowCreatedArgs e ){
if ( e.RowType == Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowType.HeaderRow ){
foreach ( Telerik.Web.UI.GridExcelBuilder.CellElement cell in e.Row.Cells ){
if( cell.Data != null )
cell.Data.DataItem =
null;
}
}
}

Any help is appreciated.

 

Nasir
Top achievements
Rank 1
 answered on 21 Mar 2017
0 answers
51 views
I have a project with many, many grids. I want to add a clear all filters button to every grid in my project. I have a clear all method that works beautifully, but I can't seem to add a button with a successful event handler to all my grids without manually going through and adding the button. I would like it somewhere at the top of my grid. Any help would be appreciated. 
Jessica
Top achievements
Rank 1
 asked on 20 Mar 2017
9 answers
120 views
Here's the sample code I'm using:

<script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p.js"></script>
<noscript>
<a href="http://polldaddy.com/poll/">Test</a><span style="font-size:9px;">
<a href="http://polldaddy.com/features-surveys/">test2</a></span>
</noscript>

When I add the code to the HTML mode, then switch to the Design Mode, then switch back to the HTML mode,
1) the <script> tags disappear, and
2) the <noscript> tags have inserted "originalAttribute=X" and "originalPath=Y" into the anchor tags.

In IE only (I'm using IE 8), both 1 and 2 can be reproduced by pasting the sample code above into the Editor Demo: http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultcs.aspx.

Thanks.
Rumen
Telerik team
 answered on 20 Mar 2017
1 answer
217 views

I have a webform with an aspscripmanager and and radsciptmanager but for some reason they dont like working together at all. My code is below:

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">   
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

    <div style="width: 100%; height: 100%">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <div id="divImage" style="display:none">
                    <asp:Image ID="img1" runat="server" ImageUrl="~/Image/ajax-loader3.gif" />
                    Processing....
                </div>
                <asp:Button ID="btnMP1Show" runat="server" Text="Show MP1" style="display:none"/>
                <asp:Panel ID="Panel1" runat="server" CssClass="panel001">
                    <asp:Button ID="btnMP3OK" runat="server" Text="Return" OnClick="btnMP3OK_Click"/>
                    <asp:Button ID="btnMP3Manual" runat="server" Text="Manual" OnClick="btnMP3Manual_Click" />                 
                    <h1>Flight Operational Quality Assurance</h1>
                    <div style="overflow:auto; border: 1px solid black; width: 100%; height: 500px">
                        <%--<telerik:RadScriptManager runat="server" ID="RadScriptManager1"></telerik:RadScriptManager>--%>
                        <telerik:RadSkinManager runat="server" ID="RadSkinManager1"  ShowChooser="true"></telerik:RadSkinManager>
                        <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1"></telerik:RadAjaxManager>
                        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
                        <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" ShowStatusBar="True" runat="server" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowFilteringByColumn="True" AllowSorting="True" AutoGenerateEditColumn="True" DataSourceID="ObjectDataSource1" EnableHeaderContextFilterMenu="True" EnableHeaderContextMenu="True" ShowFooter="True" ShowGroupPanel="True">
                            <PagerStyle Mode="NumericPages"></PagerStyle>
                            <GroupingSettings CollapseAllTooltip="Collapse all groups" />
                            <ClientSettings AllowDragToGroup="True" AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
                                <Selecting AllowRowSelect="true"></Selecting>
                            </ClientSettings>                       
                            <MasterTableView EnableHierarchyExpandAll="true" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" AllowMultiColumnSorting="True">
                                <DetailTables>
                                    <telerik:GridTableView EnableHierarchyExpandAll="true" DataKeyNames="SectorKey" DataSourceID="ObjectDataSource2" Width="100%" runat="server">
                                        <ParentTableRelation>
                                            <telerik:GridRelationFields DetailKeyField="SectorKey" MasterKeyField="SectorKey"></telerik:GridRelationFields>
                                        </ParentTableRelation>
                                        <Columns>

//Confidential Code Hidden

                                        </Columns>
                                    </telerik:GridTableView>
                                </DetailTables>
                                <Columns>

// Confidential Code Hidden

                                </Columns>
                            </MasterTableView>
                            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
                            <FilterMenu RenderMode="Lightweight">
                            </FilterMenu>
                            <HeaderContextMenu RenderMode="Lightweight">
                            </HeaderContextMenu>
                        </telerik:RadGrid>

                        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
//Confidnential Code Hidden
                        </asp:ObjectDataSource>
                    </div>
                </asp:Panel>
            </ContentTemplate>
        </asp:UpdatePanel>

    </div>
</asp:Content>

Marin Bratanov
Telerik team
 answered on 20 Mar 2017
0 answers
143 views

I am using several settings in RadAjaxManager. I have a server control asp button which re-loads the whole page when clicked. To prevent that I put this setting in RadAjaxManager

     <telerik:AjaxSetting AjaxControlID="btnPrint">

        <UpdatedControls><telerik:AjaxUpdatedControl ControlID="btnPrint" />

      </UpdatedControls></telerik:AjaxSetting>

but for some reason my code behind click event does not fire. Any ideas please

    <asp:Button ID="btnPrint" runat="server" Text="Print" CssClass="button" OnClick="btnPrint_Click" ></asp:Button>

Jack
Top achievements
Rank 1
 asked on 20 Mar 2017
0 answers
75 views

Hi,

I have created a dynamic grid. but sorting not working.

here is my code.

aspx code

<telerik:RadGrid ID="radGridBICheckData" runat="server" SkinID="RadGrid">
<ClientSettings>
<Resizing EnableRealTimeResize="True" ResizeGridOnColumnResize="True" AllowColumnResize="True"
ClipCellContentOnResize="True" AllowResizeToFit="True"></Resizing>
</ClientSettings>
</telerik:RadGrid>

 

code behind

protected void Page_Init(object sender, EventArgs e)
{
try
{
                                
                DefineGridStructure();
}
catch (Exception ex)
{
Logger.Write(ex.Message, "Error", 0);
NISP.Utilities.ErrorPage.ErrorLog(ex);
}
}

private void DefineGridStructure()
{
//Defines the Grid structure
radGridBICheckData.AutoGenerateColumns = false;
radGridBICheckData.AllowMultiRowSelection = true;
radGridBICheckData.AllowFilteringByColumn = true;
radGridBICheckData.GridLines = GridLines.None;
radGridBICheckData.AllowSorting = true;
// radGridBICheckData.EnableViewState = true;
String htmlColor = "#EDEFF1";
Color backColor = ColorTranslator.FromHtml(htmlColor);
radGridBICheckData.AlternatingItemStyle.BackColor = backColor;
String editColor = "#A2A2A2";
Color editbackColor = ColorTranslator.FromHtml(editColor);
radGridBICheckData.MasterTableView.AllowSorting = true;
radGridBICheckData.MasterTableView.AllowCustomSorting = true;
radGridBICheckData.MasterTableView.AllowFilteringByColumn = true;
radGridBICheckData.MasterTableView.AllowPaging = true;
radGridBICheckData.MasterTableView.AllowCustomPaging = true;
// radGridBICheckData.MasterTableView.CanRetrieveAllData = true;
radGridBICheckData.MasterTableView.PagerStyle.AlwaysVisible = true;
radGridBICheckData.MasterTableView.PagerStyle.Position = GridPagerPosition.Bottom;
radGridBICheckData.MasterTableView.PagerStyle.Mode = GridPagerMode.NextPrevNumericAndAdvanced;
radGridBICheckData.ClientSettings.AllowKeyboardNavigation = true;
radGridBICheckData.ClientSettings.Selecting.AllowRowSelect = true;
radGridBICheckData.ClientSettings.Scrolling.AllowScroll = true;
radGridBICheckData.ClientSettings.Scrolling.UseStaticHeaders = true;
radGridBICheckData.ClientSettings.Scrolling.ScrollHeight = Unit.Pixel(390);
radGridBICheckData.FilterMenu.EnableTheming = true;
radGridBICheckData.FilterMenu.CollapseAnimation.Duration = 200;
radGridBICheckData.FilterMenu.CollapseAnimation.Type = AnimationType.OutQuint;
//Add Master table
radGridBICheckData.MasterTableView.Name = "BICheck";
string[] resolutionArr;
if (SessionManager.GetSessionObject("ScreenResolution") != null)
{
resolutionArr = SessionManager.GetSessionObject("ScreenResolution").ToString().Split('*');
ApplicaionResolutionSettings.ResizingGridForResolution(ApplicationConstants.RES_FILE_TEMPLATE_ROW_DEFINITION, resolutionArr, radGridBICheckData, ApplicationConstants.RES_POPUP_SINGLE_GRID);
}

radGridBICheckData.MasterTableView.EnableColumnsViewState = false;
//GridEditCommandColumn col1 = new GridEditCommandColumn();
//col1.ButtonType = GridButtonColumnType.ImageButton;
//col1.UpdateImageUrl = "../App_Themes/Default/Grid/Update.gif";
//col1.EditImageUrl = "../App_Themes/Default/Grid/Edit.gif";
//col1.InsertImageUrl = "../App_Themes/Default/Grid/Insert.gif";
//col1.CancelImageUrl = "../App_Themes/Default/Grid/Cancel.gif";
//col1.Visible = true;
//col1.UniqueName = "EditCommandColumn";
//grid.MasterTableView.Columns.Add(col1);
GridBoundColumn boundColumn;
string uniqueName = string.Empty;
for (int intIndex = 0; intIndex <= 20; intIndex++)
{
boundColumn = new GridBoundColumn();
if (intIndex == 0)
{
uniqueName = "STATUS";
boundColumn.AllowFiltering = false;
// boundColumn.AllowSorting = false;
}
else
{
uniqueName = "Value" + intIndex;
boundColumn.AllowFiltering = true;
// boundColumn.AllowSorting = true;
}

boundColumn.DataField = uniqueName;
boundColumn.HeaderText = "";
boundColumn.UniqueName = uniqueName;
boundColumn.SortExpression = uniqueName;
//boundColumn.AllowFiltering = true;
//boundColumn.AllowSorting = true;
boundColumn.HeaderStyle.Width = Unit.Pixel(120);
radGridBICheckData.MasterTableView.Columns.Add(boundColumn);
}
radGridBICheckData.NeedDataSource += new GridNeedDataSourceEventHandler(this.radGridBICheckData_NeedDataSource);
radGridBICheckData.ItemDataBound += new GridItemEventHandler(this.radGridBICheckData_ItemDataBound);
radGridBICheckData.ItemCommand += new GridCommandEventHandler(this.radGridBICheckData_ItemCommand);
// radGridBICheckData.PreRender += new EventHandler(radGridBICheckData_PreRender);
}

 

thanks in advance.

rosali
Top achievements
Rank 1
 asked on 20 Mar 2017
1 answer
102 views

Hi, I have a question. When I do inline editing: I have a number of columns with integers. When I want to inline edit a column it works perfect.

However, I notice that when I "in" a cell and I use my mouse wheel the value goes up or down.

I don't want that tp happen because it can confuse people.

How to prevent this?

Rumen
Telerik team
 answered on 19 Mar 2017
6 answers
993 views
Hello All

i want bind my grid on client side after click on a button, my code is very very simple but when i want catch table view with this code,returns null
var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();

this is my full client side code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script language="javascript" type="text/javascript">
        function Button1_onclick() {          
                var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
                PageMethods.GetData(1, true, updateGrid);
            }
 
            function updateGrid(result) {
                var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
                tableView.set_dataSource(result);
                tableView.dataBind();
            }
 
 
    </script>   
    </telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server">
    <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" />
    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server" EnablePageMethods="true">
    </telerik:RadScriptManager>
    <br />
    <telerik:RadGrid ID="RadGrid1" runat="server"  EnableViewState="false">
    <MasterTableView>
        <Columns>
          <telerik:GridBoundColumn DataField="pic" HeaderText="pic" />
        </Columns>
    </MasterTableView>
    </telerik:RadGrid>
    </form>
</body>
</html>

this is my full server side code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using System.Data;
 
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    [WebMethod]
    public static List<object> GetData(int departmentID, bool SelectSubNodesPersonels)
    {
        DAL.Personels ObjPersonels = new DAL.Personels();
        DataTable DT = ObjPersonels.Personels_SELECT_BY_DepartmentID(departmentID, SelectSubNodesPersonels);
 
        return ObjPersonels.Convert_DataTable_To_List_Object(DT);
    }
}

what is the problem do you think.

Special thanks
Mohammd
Mukku
Top achievements
Rank 1
 answered on 18 Mar 2017
2 answers
133 views
Is there a way to use topojson with RadMap?
David
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 17 Mar 2017
6 answers
286 views
Is there a way or property to sisable browser autocomplete suggestions for Treeview node when editing?
Praveen
Top achievements
Rank 1
 answered on 17 Mar 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?