<ej:Grid ID="FlatGrid" runat="server" ShowStackedHeader="true" AllowPaging="True">
<Columns>
. . .
</Columns>
<StackedHeaderRows>
<ej:StackedHeaderRow>
<StackedHeaderColumns>
<ej:StackedHeaderColumn Column="OrderID,CustomerID,EmployeeID,Freight" HeaderText="Details of Orders" TextAlign="Center"/>
<ej:StackedHeaderColumn Column="ShipCity,OrderDate" HeaderText="Details of ShipMent" TextAlign="Center"/>
</StackedHeaderColumns>
</ej:StackedHeaderRow>
<ej:StackedHeaderRow>
<StackedHeaderColumns>
<ej:StackedHeaderColumn Column="OrderID,CustomerID,EmployeeID,Freight" HeaderText="Order Details" TextAlign="Center"/>
<ej:StackedHeaderColumn Column="ShipCity" HeaderText="Ship City" CssClass="e-stackrow" />
<ej:StackedHeaderColumn Column="OrderDate" HeaderText="Order Date" CssClass="e-stackrow" />
</StackedHeaderColumns>
</ej:StackedHeaderRow>
</StackedHeaderRows>
<ClientSideEvents DataBound="databound" />
</ej:Grid>
|
<ej:Grid ID="FlatGrid" runat="server" ShowStackedHeader="true" AllowPaging="True">
<Columns>
. . .
<ej:Column Field="OrderDate" HeaderText="Order Date" TextAlign="Right" Width="80" Format="{0:MM/dd/yyyy}" CssClass="e-stackhdr" />
<ej:Column Field="ShipCity" HeaderText="Ship City" Width="110" CssClass="e-stackhdr" />
</Columns>
<StackedHeaderRows>
<ej:StackedHeaderRow>
. . .
<ej:StackedHeaderColumn Column="ShipCity" HeaderText="Ship City" CssClass="e-stackrow" />
<ej:StackedHeaderColumn Column="OrderDate" HeaderText="Order Date" CssClass="e-stackrow" />
</StackedHeaderColumns>
</ej:StackedHeaderRow>
</StackedHeaderRows>
<ClientSideEvents DataBound="databound" />
</ej:Grid>
<style>
th.e-stackhdr {
display: none;
}
</style>
<script type="text/javascript">
function databound(args) {
var obj = $("#<%=FlatGrid.ClientID%>").ejGrid("instance");
obj.getHeaderTable().find(".e-stackrow").attr("rowspan", 2); //set rowspan - merging the stackedheader cells
}
</script>
|
protected void FlatGrid_ServerExcelExporting(object sender, Syncfusion.JavaScript.Web.GridEventArgs e)
{
ExcelExport exp = new ExcelExport();
FlatGrid.Model.ServerExcelQueryCellInfo = querycell;
exp.Export(FlatGrid.Model, (IEnumerable)FlatGrid.DataSource, "SeguimientoElectricidad.xlsx", ExcelVersion.Excel2013, true, true, "none");
}
protected void querycell(object obj)
{
IRange range = (IRange)obj;
range["A1:F1"].CellStyle.ColorIndex = ExcelKnownColors.Blue;
range["A2:F2"].CellStyle.ColorIndex = ExcelKnownColors.Blue;
}
|