PDA

View Full Version : [CLOSED] Grid Panel not displaying data on button click



otouri
Apr 05, 2013, 4:30 PM
[1] When Page load the grid Panel should be empty, Launch Report button the grid panel should display data but it doesn't.

[2] I would also prefere that on page load the GridPanel doesn't show up. i couldn't find how to do this:




ASPX Page:

<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeBehind="SampleCode.aspx.cs"
Inherits="DirectionLetterAutomation.SampleCode" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<html>
<head id="Head1" runat="server">
<title>Sample code</title>
</head>
<body>
<form id="Form1" runat="server">
<table style="width: 100%; padding: 10px 10px 10px 10px; vertical-align: top; background-color: #ffffff;"
border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table style="vertical-align: top; background-color: #ffffff; border: 1px solid #8BB7E3"
cellpadding="0" cellspacing="0" width="100%">
<tr>
<td colspan="2">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
</td>
</tr>
<tr>
<td colspan="2">
<ext:Button ID="btnLaunchReport" runat="server" Text="Launch Report" Cls="formButton"
CellCls="formButton" Icon="Report">
<DirectEvents>
<Click OnEvent="btnLaunchReport_Click" />
</DirectEvents>
</ext:Button>
</td>
</tr>
<tr>
<td>
<ext:Panel ID="WizardPanel" runat="server" Padding="15" AutoHeight="true" Layout="FitLayout"
ActiveIndex="0">
<Content>
<ext:GridPanel ID="gpTransactionVerificationReport" runat="server" Cls="x-grid-custom">
<Store>
<ext:Store ID="stTransactionVerificationReport" runat="server" PageSize="10">
<Model>
<ext:Model ID="mdTransactionVerificationReport" runat="server">
<Fields>
<ext:ModelField Name="ReportDate" />
<ext:ModelField Name="ReportNumber" Type="Float" />
<ext:ModelField Name="Client" Type="String" />
<ext:ModelField Name="Fund" Type="String" />
<ext:ModelField Name="OTEntry" Type="String" />
<ext:ModelField Name="GPCash" Type="String" />
<ext:ModelField Name="TotalCapitalCalls" Type="String" />
<ext:ModelField Name="TotalCashDistributions" Type="String" />
<ext:ModelField Name="TotalManagementFees" Type="String" />
<ext:ModelField Name="TotalOtherFees" Type="String" />
<ext:ModelField Name="TotalStockDistributions" Type="String" />
<ext:ModelField Name="TotalNet" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<TopBar>
<ext:Toolbar ID="ToolbarIncoming" runat="server">
<Items>
<ext:ToolbarFill ID="ToolbarFillIncoming" runat="server" />
<ext:Button ID="btnExcelIncoming" runat="server" Text="To Excel" Icon="PageExcel">
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" Width="35" />
<ext:Column ID="Column1" runat="server" Text="Report Date" DataIndex="ReportDate" />
<ext:Column ID="Column2" runat="server" Text="Report Number" Width="75" DataIndex="ReportNumber" />
<ext:Column ID="Column3" runat="server" Text="Client" Width="75" DataIndex="Client"
Flex="1" />
<ext:Column ID="Column4" runat="server" Text="Fund" Width="75" DataIndex="Fund" Flex="1" />
<ext:Column ID="Column5" runat="server" Text="OT Entry" Width="85" DataIndex="OTEntry" />
<ext:Column ID="Column6" runat="server" Text="GP Cash" Width="85" DataIndex="GP Cash" />
<ext:Column ID="Column7" runat="server" Text="Total Capital Calls" Width="85" DataIndex="TotalCapitalCalls" />
<ext:Column ID="Column8" runat="server" Text="Total Cash Distributions" Width="85"
DataIndex="TotalCashDistributions" />
<ext:Column ID="Column9" runat="server" Text="Total Other Fees" Width="85" DataIndex="TotalOtherFees" />
<ext:Column ID="Column10" runat="server" Text="Total Stock Distributions" Width="85"
DataIndex="TotalStockDistributions" />
<ext:Column ID="Column11" runat="server" Text="Total Net" Width="85" DataIndex="TotalNet" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Multi" />
</SelectionModel>
<BottomBar>
<ext:PagingToolbar ID="PagingToolbar1" runat="server">
<Items>
<ext:Label ID="Label2" runat="server" Cls="toolbarPaging" Text="Page size:" />
<ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" Width="10" />
<ext:ComboBox ID="ComboBox3" runat="server" Width="80">
<Items>
<ext:ListItem Text="1" />
<ext:ListItem Text="2" />
<ext:ListItem Text="10" />
<ext:ListItem Text="20" />
</Items>
<SelectedItems>
<ext:ListItem Value="10" />
</SelectedItems>
<Listeners>
<Select Handler="#{gpTransactionVerificationReport}.store.pageSize = parseInt(this.getValue(), 10); #{gpTransactionVerificationReport}.store.load();" />
</Listeners>
</ext:ComboBox>
</Items>
<Plugins>
<ext:ProgressBarPager ID="ProgressBarPager1" runat="server" />
</Plugins>
</ext:PagingToolbar>
</BottomBar>
<View>
<ext:GridView ID="GridView1" runat="server" ScrollOffset="2" StripeRows="true" TrackOver="true" />
</View>
</ext:GridPanel>
</Content>
<Buttons>
<ext:Button ID="btnPrev" runat="server" Text="Prev" Disabled="true" Icon="PreviousGreen"
Cls="formButton">
<DirectEvents>
<Click>
<ExtraParams>
<ext:Parameter Name="index" Value="#{WizardPanel}.items.indexOf(#{WizardPanel}.layout .activeItem)"
Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
<ext:Button ID="btnNext" runat="server" Text="Next" Icon="NextGreen" Cls="formButton">
<DirectEvents>
<Click>
<ExtraParams>
<ext:Parameter Name="index" Value="#{WizardPanel}.items.indexOf(#{WizardPanel}.layout .activeItem)"
Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:Panel>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>


Code Behind:


{

}
protected void btnLaunchReport_Click(object sender, EventArgs e)
{
this.BindData();
}
private void BindData()
{
var store = this.gpTransactionVerificationReport.GetStore();

stTransactionVerificationReport.DataSource = this.Data;
stTransactionVerificationReport.DataBind();
}

private object[] Data
{
get
{
DateTime now = DateTime.Now;

return new object[]
{


new object[] { "22-May-2012", 1," Washington State Investment Board","Blackstone Capital Partners I, L.P.", "xxx", "xxx", "xxx","xxx","xxx","xxx","xxx","xxx"},
new object[] { "22-May-2012", 1," Textron Master Trust","Blackstone Capital Partners II, L.P.", "xxx", "xxx", "xxx","xxx","xxx","xxx","xxx","xxx"},
new object[] { "22-May-2012", 1," Washington State Investment Board","Blackstone Capital Partners III, L.P.", "xxx", "xxx", "xxx","xxx","xxx","xxx","xxx","xxx"},
new object[] { "22-May-2012", 1," Textron Master Trust","Blackstone Capital Partners IV, L.P.", "xxx", "xxx", "xxx","xxx","xxx","xxx","xxx","xxx"},
new object[] { "22-May-2012", 1," Washington State Investment Board","Blackstone Capital Partners V, L.P.", "xxx", "xxx", "xxx","xxx","xxx","xxx","xxx","xxx"},
new object[] { "22-May-2012", 1," Textron Master Trust","Blackstone Capital Partners VI, L.P.", "xxx", "xxx", "xxx","xxx","xxx","xxx","xxx","xxx"},
new object[] { "22-May-2012", 1," Washington State Investment Board","Blackstone Capital Partners I, L.P.", "xxx", "xxx", "xxx","xxx","xxx","xxx","xxx","xxx"},
new object[] { "22-May-2012", 1," Textron Master Trust","Blackstone Capital Partners II, L.P.", "xxx", "xxx", "xxx","xxx","xxx","xxx","xxx","xxx"},
new object[] { "22-May-2012", 1," Washington State Investment Board","Blackstone Capital Partners III, L.P.", "xxx", "xxx", "xxx","xxx","xxx","xxx","xxx","xxx"},
new object[] { "22-May-2012", 1," Textron Master Trust","Blackstone Capital Partners IV, L.P.", "xxx", "xxx", "xxx","xxx","xxx","xxx","xxx","xxx"},
new object[] { "22-May-2012", 1," Washington State Investment Board","Blackstone Capital Partners V, L.P.", "xxx", "xxx", "xxx","xxx","xxx","xxx","xxx","xxx"},
new object[] { "22-May-2012", 1," Textron Master Trust","Blackstone Capital Partners VI, L.P.", "xxx", "xxx", "xxx","xxx","xxx","xxx","xxx","xxx"},

};
}

}

Daniil
Apr 05, 2013, 5:01 PM
Hi @otouri,

Please set up an ArrayReader for the Store.

<ext:Store runat="server">
<Reader>
<ext:ArrayReader />
</Reader>
</ext:Store>

otouri
Apr 05, 2013, 6:12 PM
Thank you for the quick reply, Can you point me to an example

geoffrey.mcgill
Apr 05, 2013, 6:30 PM
Thank you for the quick reply, Can you point me to an example

There are dozens of ArrayReader samples in the Examples Explorer (http://examples2.ext.net/)