Hi.
I am trying to export WebDataGrid Data using WebExcelExporter. I am using Infragistics 10.3.20103.2217.
I am able to download data for i am loosing the grid theme. How can i get the grid theme while downloading the gird data.
Here is my aspx page code
<asp:UpdatePanel ID="uwgCostCenterAdminUpdatePanel" runat="server"> <ContentTemplate> <ig:WebDataGrid ID="uwgCostCenterAdmin" runat="server" AutoGenerateColumns="false" Font-Size="Medium" DataKeyFields="CostCenter_id" Width="590px" OnInitializeRow="uwgCostCenterAdmin_InitializeRow" EnableAjax="true" AjaxIndicator-ImageUrl="../../images/Loading.gif" OnPageIndexChanged="uwgCostCenterAdmin_PageIndexChanged" OnColumnSorted="uwgCostCenterAdmin_ColumnSorted"> <Behaviors> <ig:Paging Enabled="true" PageSize="15" QuickPages="10" PagerMode="NumericFirstLast"> </ig:Paging> <ig:Sorting Enabled="true" SortingMode="Single" AscendingImageUrl="../../images/arrow_up.gif" DescendingImageUrl="../../images/arrow_down.gif"> <ColumnSettings> <ig:SortingColumnSetting ColumnKey="Configure" Sortable="false" /> </ColumnSettings> </ig:Sorting> </Behaviors> <Columns> <ig:BoundDataField Key="CostCenter_id" CssClass="hidden" DataFieldName="CostCenter_id"> <Header CssClass="hidden" /> </ig:BoundDataField> <ig:TemplateDataField Key="CostCenter" Width="20%"> <ItemTemplate> <asp:HyperLink ID="costcenterLink" runat="server" Text='<%# Eval("CostCenter") %>'></asp:HyperLink> </ItemTemplate> <Header Text="Cost Center" /> </ig:TemplateDataField> <ig:BoundDataField Key="Name" DataFieldName="CostCenter_Name" Width="30%"> <Header Text="Name" /> </ig:BoundDataField> <ig:BoundDataField Key="Description" DataFieldName="CostCenter_Desc" Width="35%"> <Header Text="Description" /> </ig:BoundDataField> <ig:TemplateDataField Key="Configure" Width="15%"> <ItemTemplate> <asp:HyperLink ID="costcenterConfigureLink" runat="server" Text="Configure"></asp:HyperLink> </ItemTemplate> <Header Text="Configure" /> </ig:TemplateDataField> </Columns> </ig:WebDataGrid> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="imgGo" EventName="Click" /> <asp:AsyncPostBackTrigger ControlID="cmbGroup" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel>
-- WebExcelExporter
<ig:WebExcelExporter ID="WebExcelExporter1" runat="server" DataExportMode="AllDataInDataSource" ExportMode="Download" OnCellExporting="WebExcelExporter1_CellExporting"> </ig:WebExcelExporter>
-- in Codebehind in Download Click event here is my code.
uwgCostCenterAdmin.Behaviors.Paging.Enabled = false; BindGrid(); uwgCostCenterAdmin.Columns[4].Hidden = true; WebExcelExporter1.DownloadName = "TEST"; this.WebExcelExporter1.Export(uwgCostCenterAdmin); uwgCostCenterAdmin.Behaviors.Paging.Enabled = true; BindGrid();
Please let me know what is wrong in my code. I need my grid theme to downloaded in my excel.
Thanks
Nagasai
Hi Nagasai,
What part of the theme are you losing exactly? All of it or a part here and there? Do you think you could attach a full working sample here?
regards,David Young
Hi
I am loosing formatting completely, Here is my scenario, Basically my project been upgraded form Infragistics NetAdvantage 2005 Volume 1 to 10.2.20102.1011 and later to 10.3.20103.2217.When i try to download using webexcelexporter i am loosing complete sytling.But when tried to use the same code in an new project i got styles for all the columns expect the one being modified with CellExporting Event.
Here is the code snippet,
protected void WebExcelExporter1_CellExporting(object sender, Infragistics.Web.UI.GridControls.ExcelCellExportingEventArgs e) { int currentColumnIndex = e.CurrentColumnIndex; int currentRowIndex = e.CurrentRowIndex; GridField field = this.uwgCostCenterAdmin.Columns[currentColumnIndex]; if (currentColumnIndex == 0 && !e.IsHeaderCell) { e.Cancel = true; string strText = this.uwgCostCenterAdmin.Rows[currentRowIndex - 1].Items[currentColumnIndex].Text; string formattedText = field.FormatValue(this.uwgCostCenterAdmin.Rows[currentRowIndex - 1].Items[currentColumnIndex].Value.ToString()); e.WorksheetCell.Value = strText; } }
I have attached sample code for reference. Please help me how can i get styles of the grid in my original project