Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3788
ThreadAbortException
posted

Hi,

On WebExporerBar clicked action, i am exporting the grid data into the Excel,

but On exporting the data i am getting the ThreadAbortException,

while my data is exported into the file.

after this if i clicked on any other ExplorerBar action it always give me "export to excel" action

Why does this problem?

how can i remove this problem?

[System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}

 

  <ig:WebExcelExporter ID="gridExporter" runat="server" ExportMode="Download" EnableStylesExport="false"
    DataExportMode="AllDataInDataSource">

 

<ig:WebExplorerBar ID="ActionItemPanel" runat="server" GroupExpandBehavior="SingleExpanded"
      BorderStyle="None" EnableExpandButtons="False" EnableHotTracking="False" EnableSelection="False"
      GroupExpandAction="ButtonClick" ItemIndent="2px" EnableViewState="False" AutoPostBackFlags-ItemClick="On">
      <Groups>
<ig:ExplorerBarGroup Text="Actions">
          <Items>
            <ig:ExplorerBarItem Text="export to excel">
            </ig:ExplorerBarItem>
            <ig:ExplorerBarItem Text="Item 2">
            </ig:ExplorerBarItem>
            <ig:ExplorerBarItem Text="Item 3">
            </ig:ExplorerBarItem>
            <ig:ExplorerBarItem Text="Item 4" >
            </ig:ExplorerBarItem>
            <ig:ExplorerBarItem Text="Item 5">
            </ig:ExplorerBarItem>
 </Items>
        </ig:ExplorerBarGroup>
</Groups>
    </ig:WebExplorerBar>

 

protected void Page_Load(object sender, EventArgs e) {
      ExplorerBarPanel.ItemClick += new Infragistics.Web.UI.NavigationControls.ExplorerBarItemClickEventHandler(ExplorerBarPanel_ItemClick);
      DataTable dt = new DataTable();
      dt.Columns.Add("col1", typeof(int));
      dt.Columns.Add("col2", typeof(int));
      dt.Columns.Add("col3", typeof(int));
      dt.Columns.Add("col4", typeof(int));
      for (int i = 0; i <= 50; i++) {

        dt.Rows.Add(new object[] { i, 1 + 1, 1 + 2, 1 + 3 });
      }

      this.WebDataGrid1.DataSource = dt;
      this.WebDataGrid1.DataBind();

    
    }

    protected void Button1_Click(object sender, EventArgs e) {
      this.eExporter.DownloadName = "ExportData";
      this.eExporter.DataExportMode = Infragistics.Web.UI.GridControls.DataExportMode.AllDataInDataSource;
      this.eExporter.EnableStylesExport = false;
      this.eExporter.WorkbookFormat = Infragistics.Excel.WorkbookFormat.Excel2007;
      this.eExporter.Export(true, this.WebDataGrid1);
     
    }

    protected void ExplorerBarPanel_ItemClick(object sender, Infragistics.Web.UI.NavigationControls.ExplorerBarItemClickEventArgs e) {
      if(e.Item == null || e.Item is Infragistics.Web.UI.NavigationControls.ExplorerBarGroup)
        return;
      Button1_Click(null, null);
    }