Fix filtri in export excel x MtzProg
This commit is contained in:
Binary file not shown.
@@ -1,72 +1,71 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="ExcelExportMtzPrev.aspx.cs"
|
||||
Inherits="GIM_site.ExcelExportMtzPrev" %>
|
||||
Inherits="GIM_site.ExcelExportMtzPrev" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head id="Head1" runat="server">
|
||||
<title></title>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<div>
|
||||
<asp:GridView ID="grView" runat="server" AutoGenerateColumns="False"
|
||||
DataKeyNames="idxIntPro" DataSourceID="ods" OnDataBound="grView_DataBound" EnableModelValidation="True">
|
||||
<EmptyDataTemplate>
|
||||
<asp:Label runat="server" ID="lblNoRecord" Text='<%# traduci("noRecord") %>' />
|
||||
</EmptyDataTemplate>
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="lblImpianto">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblNomeImpianto" runat="server" Text='<%# Eval("nomeImpianto") %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="lblMacchina">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblNomeMacchina" runat="server" Text='<%# Eval("nomeMacchina") %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="codMacchina">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblCodMacchina" runat="server" Text='<%# Eval("codMacchina") %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="inizio" HeaderText="inizioMtzPro"
|
||||
HtmlEncode="False" />
|
||||
<%--DataFormatString="{0:dd/MM/yy}" --%>
|
||||
<asp:BoundField DataField="frequenza" HeaderText="frequenzaMtzPro" />
|
||||
<asp:BoundField DataField="cadenza" HeaderText="cadenzaMtzPro" />
|
||||
<asp:TemplateField HeaderText="Descrizione">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblDescrizione" runat="server" Text='<%# Eval("descrizione") %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="descrTipo" HeaderText="lblTipoGuastoShort" />
|
||||
<asp:TemplateField HeaderText="chkImpFermoShort" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblIsFermo" runat="server" Text='<%# Eval("isFermo") %>' />
|
||||
</ItemTemplate>
|
||||
<ItemStyle HorizontalAlign="Center"></ItemStyle>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="lblPriorShort" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label6" runat="server" Text='<%# Eval("idxPriorita") %>' ToolTip='<%# Eval("descrPriorita") %>' />
|
||||
</ItemTemplate>
|
||||
<ItemStyle HorizontalAlign="Center"></ItemStyle>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}"
|
||||
SelectMethod="GetData" TypeName="GIM_dataLayer.DS_applicazioneTableAdapters.v_mtzProgExpTableAdapter"
|
||||
FilterExpression=" codMacchina LIKE '%{0}%' OR nomeMacchina LIKE '%{0}%' OR descrizione LIKE '%{0}%' ">
|
||||
<FilterParameters>
|
||||
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="valoreCercato" />
|
||||
<asp:SessionParameter DefaultValue="0" Name="idxTipo" SessionField="idxTipo_filt"
|
||||
Type="Int32" />
|
||||
<asp:SessionParameter DefaultValue="0" Name="idxMacchina" SessionField="idxMacchina_filt"
|
||||
Type="Int32" />
|
||||
</FilterParameters>
|
||||
</asp:ObjectDataSource>
|
||||
</div>
|
||||
</form>
|
||||
<form id="form1" runat="server">
|
||||
<div>
|
||||
<asp:GridView ID="grView" runat="server" AutoGenerateColumns="False"
|
||||
DataKeyNames="idxIntPro" DataSourceID="ods" OnDataBound="grView_DataBound" EnableModelValidation="True">
|
||||
<EmptyDataTemplate>
|
||||
<asp:Label runat="server" ID="lblNoRecord" Text='<%# traduci("noRecord") %>' />
|
||||
</EmptyDataTemplate>
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="lblImpianto">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblNomeImpianto" runat="server" Text='<%# Eval("nomeImpianto") %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="lblMacchina">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblNomeMacchina" runat="server" Text='<%# Eval("nomeMacchina") %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="codMacchina">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblCodMacchina" runat="server" Text='<%# Eval("codMacchina") %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="inizio" HeaderText="inizioMtzPro"
|
||||
HtmlEncode="False" />
|
||||
<%--DataFormatString="{0:dd/MM/yy}" --%>
|
||||
<asp:BoundField DataField="frequenza" HeaderText="frequenzaMtzPro" />
|
||||
<asp:BoundField DataField="cadenza" HeaderText="cadenzaMtzPro" />
|
||||
<asp:TemplateField HeaderText="Descrizione">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblDescrizione" runat="server" Text='<%# Eval("descrizione") %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="descrTipo" HeaderText="lblTipoGuastoShort" />
|
||||
<asp:TemplateField HeaderText="chkImpFermoShort" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblIsFermo" runat="server" Text='<%# Eval("isFermo") %>' />
|
||||
</ItemTemplate>
|
||||
<ItemStyle HorizontalAlign="Center"></ItemStyle>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="lblPriorShort" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label6" runat="server" Text='<%# Eval("idxPriorita") %>' ToolTip='<%# Eval("descrPriorita") %>' />
|
||||
</ItemTemplate>
|
||||
<ItemStyle HorizontalAlign="Center"></ItemStyle>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}"
|
||||
SelectMethod="GetData" TypeName="GIM_dataLayer.DS_applicazioneTableAdapters.v_mtzProgExpTableAdapter"
|
||||
FilterExpression=" codMacchina LIKE '%{0}%' OR nomeMacchina LIKE '%{0}%' OR descrizione LIKE '%{0}%' ">
|
||||
<FilterParameters>
|
||||
<asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="valoreCercato" />
|
||||
<asp:SessionParameter DefaultValue="0" Name="idxTipo" SessionField="idxTipo_filt" Type="Int32" />
|
||||
<asp:SessionParameter DefaultValue="0" Name="idxImpianto" SessionField="idxImpianto_filt" Type="Int32" />
|
||||
<asp:SessionParameter DefaultValue="0" Name="idxMacchina" SessionField="idxMacchina_filt" Type="Int32" />
|
||||
</FilterParameters>
|
||||
</asp:ObjectDataSource>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+103
-110
@@ -6,118 +6,111 @@ using System.Web.UI.WebControls;
|
||||
|
||||
namespace GIM_site
|
||||
{
|
||||
public partial class ExcelExportMtzPrev : System.Web.UI.Page
|
||||
public partial class ExcelExportMtzPrev : System.Web.UI.Page
|
||||
{
|
||||
/// <summary>
|
||||
/// evento dati associati a controllo
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void grView_DataBound(object sender, EventArgs e)
|
||||
{
|
||||
/// <summary>
|
||||
/// evento dati associati a controllo
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void grView_DataBound(object sender, EventArgs e)
|
||||
if (grView.Rows.Count > 0)
|
||||
{
|
||||
// aggiorno gli headers
|
||||
foreach (TableCell cella in grView.HeaderRow.Cells)
|
||||
{
|
||||
if (grView.Rows.Count > 0)
|
||||
{
|
||||
// aggiorno gli headers
|
||||
foreach (TableCell cella in grView.HeaderRow.Cells)
|
||||
{
|
||||
try
|
||||
{
|
||||
cella.Text = traduci(cella.Text);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
cella.Text = traduci(cella.Text);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
/// <summary>
|
||||
/// wrapper traduzione
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(object lemma)
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma.ToString());
|
||||
}
|
||||
/// <summary>
|
||||
/// fix rendering tabelle standard in webform
|
||||
/// </summary>
|
||||
/// <param name="control"></param>
|
||||
public override void VerifyRenderingInServerForm(Control control)
|
||||
{
|
||||
// Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time.
|
||||
}
|
||||
/// <summary>
|
||||
/// Si occupa di rendere l'out HTML come excel file (mimetype)
|
||||
/// </summary>
|
||||
private void doExport()
|
||||
{
|
||||
Response.Clear();
|
||||
Response.AddHeader("content-disposition", "attachment; filename=SchemaInterventi.xls");
|
||||
Response.Charset = "";
|
||||
// If you want the option to open the Excel file without saving than
|
||||
// comment out the line below
|
||||
Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
||||
Response.ContentType = "application/vnd.xls";
|
||||
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
|
||||
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
|
||||
grView.RenderControl(htmlWrite);
|
||||
Response.Write(stringWrite.ToString());
|
||||
Response.End();
|
||||
}
|
||||
#if false
|
||||
/// <summary>
|
||||
/// restituisce la data formattata coem da web.config
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public string dtFormat(string key)
|
||||
{
|
||||
return memLayer.ML.CRS("key");
|
||||
}
|
||||
#endif
|
||||
|
||||
#region area protected
|
||||
|
||||
/// <summary>
|
||||
/// caricamento pagina
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
aggiornamento();
|
||||
doExport();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public void aggiornamento()
|
||||
{
|
||||
grView.AllowPaging = false;
|
||||
checkFixOds();
|
||||
ods.DataBind();
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sistemo filtraggio con valori selezionati
|
||||
/// </summary>
|
||||
private void checkFixOds()
|
||||
{
|
||||
ods.FilterExpression = "( codMacchina LIKE '%{0}%' OR nomeMacchina LIKE '%{0}%' OR descrizione LIKE '%{0}%' )";
|
||||
if (memLayer.ML.isInSessionObject("idxTipo_filt"))
|
||||
{
|
||||
ods.FilterExpression += " AND (idxTipo = {1})";
|
||||
}
|
||||
if (memLayer.ML.isInSessionObject("idxMacchina_filt"))
|
||||
{
|
||||
ods.FilterExpression += " AND (idxMacchina = {2})";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// wrapper traduzione
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(object lemma)
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma.ToString());
|
||||
}
|
||||
/// <summary>
|
||||
/// fix rendering tabelle standard in webform
|
||||
/// </summary>
|
||||
/// <param name="control"></param>
|
||||
public override void VerifyRenderingInServerForm(Control control)
|
||||
{
|
||||
// Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time.
|
||||
}
|
||||
/// <summary>
|
||||
/// Si occupa di rendere l'out HTML come excel file (mimetype)
|
||||
/// </summary>
|
||||
private void doExport()
|
||||
{
|
||||
Response.Clear();
|
||||
Response.AddHeader("content-disposition", "attachment; filename=SchemaInterventi.xls");
|
||||
Response.Charset = "";
|
||||
// If you want the option to open the Excel file without saving than
|
||||
// comment out the line below
|
||||
Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
||||
Response.ContentType = "application/vnd.xls";
|
||||
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
|
||||
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
|
||||
grView.RenderControl(htmlWrite);
|
||||
Response.Write(stringWrite.ToString());
|
||||
Response.End();
|
||||
}
|
||||
|
||||
#region area protected
|
||||
|
||||
/// <summary>
|
||||
/// caricamento pagina
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
aggiornamento();
|
||||
doExport();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public void aggiornamento()
|
||||
{
|
||||
grView.AllowPaging = false;
|
||||
checkFixOds();
|
||||
ods.DataBind();
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sistemo filtraggio con valori selezionati
|
||||
/// </summary>
|
||||
private void checkFixOds()
|
||||
{
|
||||
ods.FilterExpression = "( codMacchina LIKE '%{0}%' OR nomeMacchina LIKE '%{0}%' OR descrizione LIKE '%{0}%' )";
|
||||
if (memLayer.ML.isInSessionObject("idxTipo_filt"))
|
||||
{
|
||||
ods.FilterExpression += " AND (idxTipo = {1})";
|
||||
}
|
||||
if (memLayer.ML.isInSessionObject("idxImpianto_filt"))
|
||||
{
|
||||
ods.FilterExpression += " AND (idxImpianto = {2})";
|
||||
}
|
||||
if (memLayer.ML.isInSessionObject("idxMacchina_filt"))
|
||||
{
|
||||
ods.FilterExpression += " AND (idxMacchina = {3})";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+20
-21
@@ -1,51 +1,50 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// <generato automaticamente>
|
||||
// Codice generato da uno strumento.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </generato automaticamente>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GIM_site
|
||||
{
|
||||
|
||||
|
||||
namespace GIM_site {
|
||||
|
||||
|
||||
public partial class ExcelExportMtzPrev {
|
||||
|
||||
/// <summary>
|
||||
/// Head1 control.
|
||||
/// Controllo Head1.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
|
||||
|
||||
/// <summary>
|
||||
/// form1 control.
|
||||
/// Controllo form1.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// grView control.
|
||||
/// Controllo grView.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.GridView grView;
|
||||
|
||||
/// <summary>
|
||||
/// ods control.
|
||||
/// Controllo ods.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
|
||||
}
|
||||
|
||||
@@ -6,84 +6,84 @@ using System.Web.UI.WebControls;
|
||||
|
||||
public partial class ExcelExportMtzPrevPending : System.Web.UI.Page
|
||||
{
|
||||
/// <summary>
|
||||
/// evento dati associati a controllo
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void grView_DataBound(object sender, EventArgs e)
|
||||
/// <summary>
|
||||
/// evento dati associati a controllo
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void grView_DataBound(object sender, EventArgs e)
|
||||
{
|
||||
if (grView.Rows.Count > 0)
|
||||
{
|
||||
if (grView.Rows.Count > 0)
|
||||
LinkButton lb;
|
||||
// aggiorno gli headers
|
||||
foreach (TableCell cella in grView.HeaderRow.Cells)
|
||||
{
|
||||
try
|
||||
{
|
||||
LinkButton lb;
|
||||
// aggiorno gli headers
|
||||
foreach (TableCell cella in grView.HeaderRow.Cells)
|
||||
{
|
||||
try
|
||||
{
|
||||
lb = (LinkButton)cella.Controls[0];
|
||||
lb.Text = traduci(lb.Text);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
lb = (LinkButton)cella.Controls[0];
|
||||
lb.Text = traduci(lb.Text);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// wrapper traduzione
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(object lemma)
|
||||
}
|
||||
/// <summary>
|
||||
/// wrapper traduzione
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(object lemma)
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// fix x export excel
|
||||
/// </summary>
|
||||
/// <param name="control"></param>
|
||||
public override void VerifyRenderingInServerForm(Control control)
|
||||
{
|
||||
// Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time.
|
||||
}
|
||||
|
||||
private void doExport()
|
||||
{
|
||||
Response.Clear();
|
||||
Response.AddHeader("content-disposition", "attachment; filename=InterventiProgrammati.xls");
|
||||
Response.Charset = "";
|
||||
// If you want the option to open the Excel file without saving than
|
||||
// comment out the line below
|
||||
Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
||||
Response.ContentType = "application/vnd.xls";
|
||||
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
|
||||
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
|
||||
grView.RenderControl(htmlWrite);
|
||||
Response.Write(stringWrite.ToString());
|
||||
Response.End();
|
||||
|
||||
}
|
||||
|
||||
#region area protected
|
||||
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma.ToString());
|
||||
aggiornamento();
|
||||
doExport();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// fix x export excel
|
||||
/// </summary>
|
||||
/// <param name="control"></param>
|
||||
public override void VerifyRenderingInServerForm(Control control)
|
||||
{
|
||||
// Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time.
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void doExport()
|
||||
{
|
||||
Response.Clear();
|
||||
Response.AddHeader("content-disposition", "attachment; filename=InterventiProgrammati.xls");
|
||||
Response.Charset = "";
|
||||
// If you want the option to open the Excel file without saving than
|
||||
// comment out the line below
|
||||
Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
||||
Response.ContentType = "application/vnd.xls";
|
||||
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
|
||||
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
|
||||
grView.RenderControl(htmlWrite);
|
||||
Response.Write(stringWrite.ToString());
|
||||
Response.End();
|
||||
public void aggiornamento()
|
||||
{
|
||||
grView.AllowPaging = false;
|
||||
ods.DataBind();
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region area protected
|
||||
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
aggiornamento();
|
||||
doExport();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void aggiornamento()
|
||||
{
|
||||
grView.AllowPaging = false;
|
||||
ods.DataBind();
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+14
-14
@@ -1,10 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// <generato automaticamente>
|
||||
// Codice generato da uno strumento.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </generato automaticamente>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -12,29 +12,29 @@
|
||||
public partial class ExcelExportMtzPrevPending {
|
||||
|
||||
/// <summary>
|
||||
/// form1 control.
|
||||
/// Controllo form1.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// grView control.
|
||||
/// Controllo grView.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.GridView grView;
|
||||
|
||||
/// <summary>
|
||||
/// ods control.
|
||||
/// Controllo ods.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user