I'm trying a sample from Infragistics 3.0 (.NET 2.0) to export an UltraWebGrid to Excel formal.
But the bowser says "server cannot set content type after http headers have been sent".
code:
<%@ Page Language="C#" MasterPageFile="~/MasterPages/Head.master" AutoEventWireup="true" CodeFile="DBViewer.aspx.cs" Inherits="Viewers_DBViewer" %>...<asp:Content ID="contentHeader" ContentPlaceHolderID="HeaderPlaceHolder1" runat="server"> ...//javascripts</asp:Content><asp:Content ID="content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> ... <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> ... <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">Excel</asp:LinkButton> ... <obln:inhUltraWebGridDatabase id="UltraWebGrid1" runat="server" OnInitializeLayout="UltraWebGrid1_InitializeLayout" OnInitializeRow="UltraWebGrid1_InitializeRow" ImageDirectory="/ig_common/Images/"> ... </obln:inhUltraWebGridDatabase> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="txtSearch" EventName="TextChanged"/> </Triggers> </asp:UpdatePanel> ... <igxl:UltraWebGridExcelExporter ID="UltraWebGridExcelExporter1" runat="server" OnInitializeRow="UltraWebGridExcelExporter1_InitializeRow" OnBeginExport="UltraWebGridExcelExporter1_BeginExport"> </igxl:UltraWebGridExcelExporter></asp:Content>What can I do in this case?
You likely need to trigger a normal postback with whatever control (likely your LinkButton1 instance) that you're using to cause the export.
I provide additional details in the following forum thread:http://forums.infragistics.com/forums/t/2001.aspx
works4me:
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <Triggers> <asp:PostBackTrigger ControlID="LinkButton1" /> </Triggers> <ContentTemplate> <table> <tbody> <tr> <td><asp:Label id="lblToolbar" runat="server"></asp:Label></td> <td><asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">Excel</asp:LinkButton></td> </tr> </tbody> </table> ...