Hello Medo.
Here is a small example about one of the ways you can do that:
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.Store1.DataSource = new object[]
{
new object[] { 1, "3m Co", 71.72, 0.02, "8/1 12:00am", 0.03 },
new object[] { 2, "Alcoa Inc", 29.01, 0.42, "7/1 12:00pm", 1.47 },
new object[] { 3, "Walmart", 1.72, 0.42, "9/1 12:00am", 0.33 },
};
this.Store1.DataBind();
}
}
protected void Testing(object sender, DirectEventArgs e)
{
X.MessageBox.Alert("Test", GridData.Value.ToString()).Show();
}
</script>
<!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>Export Data from GridPanel into Excel using a full PostBack - Ext.NET Examples</title>
<link href="resources/css/examples.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var saveData = function() {
GridData.setValue(Ext.encode(GridPanel1.getRowsValues({ selectedOnly: false })));
};
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Hidden ID="GridData" runat="server" />
<ext:Store ID="Store1" runat="server">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="id" Type="Int" />
<ext:RecordField Name="company" />
<ext:RecordField Name="price" Type="Float" />
<ext:RecordField Name="change" Type="Float" />
<ext:RecordField Name="lastChange" Type="Date" DateFormat="M/d hh:mmtt" />
<ext:RecordField Name="pctChange" Type="Float" />
</Fields>
</ext:ArrayReader>
</Reader>
<DirectEventConfig IsUpload="true" />
</ext:Store>
<ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" StripeRows="true"
TrackMouseOver="true" Width="600" Height="350" AutoExpandColumn="Company">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ColumnID="Company" Header="Company" Width="160" DataIndex="company" />
<ext:Column Header="Price" Width="75" DataIndex="price">
<Renderer Format="UsMoney" />
</ext:Column>
<ext:Column Header="Change" Width="75" DataIndex="change" />
<ext:DateColumn Header="Last Updated" Width="85" DataIndex="lastChange" Format="dd/MM/yyyy" />
<ext:Column Header="Pct.Change" Width="75" DataIndex="pctChange" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
</SelectionModel>
<TopBar>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:ToolbarFill ID="ToolbarFill1" runat="server" />
<ext:Button ID="Button2" runat="server" Text="Show Data" Icon="Accept">
<Listeners>
<Click Fn="saveData" />
</Listeners>
<DirectEvents>
<Click OnEvent="Testing" />
</DirectEvents>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
</ext:GridPanel>
</form>
</body>
</html>
This is the command that save the data from the GridPanel into a HiddenField:
GridData.setValue(Ext.encode(GridPanel1.getRowsValues({ selectedOnly: false })));
There you can configure what you want to save from the grid.
In this post
http://forums.ext.net/showthread.php...ll=1#post48451 you can see a better explanation about those configurations.
Hope this helps.