May 11, 2010, 1:19 PM
[CLOSED] How to bind a store to a viewmodel
Hi to all
I have two questions:
1) How it is possible to bind a store to a view model of a user control?
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BPM.MVC.Web.ViewData.PlayerViewData>"%>
<ext:ResourceManagerProxy ID="ResourceManagerProxy1" runat="server" />
<ext:Store ID="Players" runat="server" AutoDataBind="true" AutoLoad="true" DataSource="<%# Model.PlayerList %>">
<Reader>
<ext:JsonReader IDProperty="ID">
<Fields>
<ext:RecordField Name="FirstName" />
<ext:RecordField Name="LastName" />
<ext:RecordField Name="ClubName" />
<ext:RecordField Name="IndexNumber" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:GridPanel
ID="GridPanel1"
runat="server"
Title="Players"
Frame="true"
StoreID="Players"
Height="600">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column DataIndex="FirstName" Header="FirstName" Width="150" />
<ext:Column DataIndex="LastName" Header="LastName" Width="150" />
<ext:Column DataIndex="ClubName" Header="ClubName" Width="150" />
<ext:Column DataIndex="IndexNumber" Header="IndexNumber" Width="150" />
</Columns>
</ColumnModel>
<View>
<ext:GridView ID="GridView1" runat="server" EnableRowBody="true">
<GetRowClass Handler="rowParams.body = '<p>' + record.data.Notes + '</p>'; return 'x-grid3-row-expanded';" />
</ext:GridView>
</View>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
</SelectionModel>
</ext:GridPanel>
2) How should I pass the ViewData using the controller as follows:
public Ext.Net.MVC.PartialViewResult xIndex(string containerId)
{
PlayerViewData <U>viewData</U> = ViewDataFactory.CreateBaseViewData<PlayerViewData>("Player List");
return new Ext.Net.MVC.PartialViewResult(containerId, RenderMode.RenderTo);
}
Thank you for help;-)Best regards,
Tiramisu