Apr 29, 2014, 9:40 PM
Grid Panel ObjectDataSource with sub property
hello,
I am using the basic object datasource example to populate the EXT grid panel.
my object I am using, contains basic properties.
name
description
weapontypeID
It also contains a sub property (since my object is from ADO.Net and displaying the available join)
weapontype1.weapontype.name.
When I use the datasource as a list of objects. the name, description, and weapontypeid work fine, but I can never get the 'sub property' within the internal object to display correctly.
My code is below:
many thanks.
I am using the basic object datasource example to populate the EXT grid panel.
my object I am using, contains basic properties.
name
description
weapontypeID
It also contains a sub property (since my object is from ADO.Net and displaying the available join)
weapontype1.weapontype.name.
When I use the datasource as a list of objects. the name, description, and weapontypeid work fine, but I can never get the 'sub property' within the internal object to display correctly.
My code is below:
<ext:GridPanel
ID="MarketPanel"
runat="server"
Title="Market"
Height="600"
>
<Store>
<ext:Store ID="Store1" runat="server" >
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="name" />
<ext:ModelField Name="description" />
<ext:ModelField Name="weapontype" />
<ext:ModelField Name="weapontype.weapontype1.name" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column runat="server" Text="Name" DataIndex="name" />
<ext:Column runat="server" Text="Description" DataIndex="description" Flex="1"/>
<ext:Column runat="server" Text="Weapon TypeID " DataIndex="weapontype"/>
<ext:Column runat="server" Text="Weapon Type" DataIndex="weapontype.weapontype1.name />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel runat="server" />
</SelectionModel>
<BottomBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button runat="server" Text="Print" Icon="Printer" Handler="this.up('grid').print();" />
</Items>
</ext:Toolbar>
</BottomBar>
</ext:GridPanel>
protected void Page_Load(object sender, EventArgs e)
{
BLL.BLL_Market BLLMarket = new BLL.BLL_Market();
Store1.DataSource = BLLMarket.getAllWeapons();
}
How would I bind this correctly? I could wrap my object in a container, accessing these sub-properties on creation but I want to avoid that.many thanks.