Feb 01, 2011, 12:51 PM
Partial View Error inside TabPanel
Hi!
Based on MVC Example of Ext. Net (http://mvc.ext.net/); I want to do something similar to Customers Details with tabs and floatable frame in orders grid.
All content in floatable tab is encapsulated in a "ViewUserControl" following MVC architecture.
Inside the tabs I put some textboxes and a partial view in each tab; but this partial view hasn't been rendering.
To provide an example I get MVC Example Source, in OrderDetails.ascx I replace this piece of code:
I attach the code of partial view
Based on MVC Example of Ext. Net (http://mvc.ext.net/); I want to do something similar to Customers Details with tabs and floatable frame in orders grid.
All content in floatable tab is encapsulated in a "ViewUserControl" following MVC architecture.
Inside the tabs I put some textboxes and a partial view in each tab; but this partial view hasn't been rendering.
To provide an example I get MVC Example Source, in OrderDetails.ascx I replace this piece of code:
<ext:Panel runat="server" Title="Products" Layout="fit">
<Items>
<ext:GridPanel
runat="server"
StoreID="dsOrderDetails"
Border="false"
TrackMouseOver="true">
<ColumnModel runat="server">
<Columns>
<ext:Column Header="OrderID" DataIndex="OrderID" Hidden="true" />
<ext:Column Header="Product" DataIndex="Product" />
<ext:Column Header="Quantity" DataIndex="Quantity" />
<ext:Column Header="UnitPrice" DataIndex="UnitPrice">
<Renderer Format="UsMoney" />
</ext:Column>
<ext:Column Header="Discount" DataIndex="Discount">
<Renderer Handler="return Math.round(value*100) + '%';" />
</ext:Column>
<ext:GroupingSummaryColumn
Header="Total Price"
Align="Right"
ColumnID="TotalPrice"
DataIndex="TotalPrice"
SummaryType="Sum">
<Renderer Format="UsMoney" />
<SummaryRenderer Format="UsMoney" />
</ext:GroupingSummaryColumn>
</Columns>
</ColumnModel>
<View>
<ext:GroupingView
runat="server"
AutoFill="true"
ShowGroupName="false"
EnableNoGroups="true"
HideGroupedColumn="true"
/>
</View>
<SelectionModel>
<ext:RowSelectionModel runat="server" />
</SelectionModel>
<Plugins>
<ext:GroupingSummary runat="server" />
</Plugins>
</ext:GridPanel>
</Items>
</ext:Panel>
For this one:<ext:Panel runat="server" Title="Products" Layout="fit">
<Items>
<ext:Panel ID="CustomGridSelector" runat="server" Border="false" Layout="Fit" Height="500">
<AutoLoad Url="<%$ RouteUrl : RouteName=Default, controller=Controls, Action=CustomGridSelector %>">
<Params>
<ext:Parameter Name="containerId" Value="#{CustomGridSelector}" Mode="Value" />
<ext:Parameter Name="rutaDisponibles" AutoDataBind="true" Value='<%# this.Page.GetRouteUrl("Presencia", new { ci = 1, controller = "ContadoresUsuario", action = "ListaContadores" }) %>'
Mode="Value">
</ext:Parameter>
<ext:Parameter Name="rutaSeleccionado" AutoDataBind="true" Value='<%# this.Page.GetRouteUrl("Presencia", new { ci = 1, controller = "ContadoresUsuario", action = "ListaContadores" }) %>'
Mode="Value">
</ext:Parameter>
<ext:Parameter Name="selectedItemsStore" Value="ContadoresSeleccionados" Mode="Value" />
</Params>
</AutoLoad>
</ext:Panel>
<ext:Hidden ID="ContadoresSeleccionados" runat="server" />
</Items>
</ext:Panel>
The first time, my partial view doesn't appear but if I change the tab and I return to it; the partial view appears. Why?I attach the code of partial view
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Softmachine.Millenium.Presentation.Web.MVC.Client.Helpers.WebControls.CustomGridSelector>" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Assembly="SoftMachine.Common.Presentation.Web" Namespace="Ext.Net" TagPrefix="SoftMachine" %>
<script type="text/javascript" src='<%= Html.ResolveUrl("~/resources/js/Millenium.Controls.Selector.js") %>'></script>
<ext:BorderLayout runat="server">
<Center>
<ext:Panel runat="server" Border="false">
<Items>
<ext:BorderLayout runat="server" Cls="splitter">
<West Split="true">
<ext:Panel runat="server" ID="panelDisponibles" Layout="Fit" Draggable="false" Border="false">
<Items>
<ext:GridPanel runat="server" ID="gridDisponibles" AutoScroll="true" Draggable="false"
EnableDragDrop="false" AutoExpandColumn="Nombre">
<Store>
<ext:Store runat="server" ID="dsDisponibles" AutoLoad="true">
<Proxy>
<ext:HttpProxy Url='<%# Model.RutaDisponibles %>' Method="GET" AutoDataBind="true" />
</Proxy>
<SortInfo Field="Nombre" Direction="ASC" />
<Reader>
<ext:JsonReader IDProperty="CodigoInterno" Root="data" TotalProperty="totalCount">
<Fields>
<ext:RecordField Name="CodigoInterno" />
<ext:RecordField Name="Nombre" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column ColumnID="Nombre" Header="<%$ AppRecursos : sm_txt_disponibles %>" DataIndex="Nombre">
<Renderer Handler="return Ext.util.Format.htmlEncode(value);" />
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel SingleSelect="false" />
</SelectionModel>
<Listeners>
<CellDblClick Handler="Millenium.Controls.Selector.add(gridDisponibles, gridSeleccionados);" />
</Listeners>
</ext:GridPanel>
</Items>
</ext:Panel>
</West>
<Center Split="true">
<ext:Panel runat="server" ID="panelBotones" Layout="Row" Draggable="false" Width="40" Frame="false">
<Items>
<ext:Panel runat="server" RowHeight="0.5" Border="false" Draggable="false" />
<ext:Panel runat="server" Height="32" Padding="10" Border="false" Draggable="false">
<Items>
<ext:Button ID="btnAdd" runat="server" Icon="ResultsetNext" ToolTip="<%$ AppRecursos : sm_txt_agregar %>">
<Listeners>
<Click Handler="Millenium.Controls.Selector.add();" />
</Listeners>
</ext:Button>
</Items>
</ext:Panel>
<ext:Panel runat="server" Height="32" Padding="10" Border="false" Draggable="false">
<Items>
<ext:Button ID="btnAddAll" runat="server" Icon="ResultsetLast" ToolTip="<%$ AppRecursos : sm_txt_agregarTodos %>">
<Listeners>
<Click Handler="Millenium.Controls.Selector.addAll();" />
</Listeners>
</ext:Button>
</Items>
</ext:Panel>
<ext:Panel runat="server" Height="32" Padding="10" Border="false" Draggable="false">
<Items>
<ext:Button ID="btnRemove" runat="server" Icon="ResultsetPrevious" ToolTip="<%$ AppRecursos : sm_txt_borrar %>">
<Listeners>
<Click Handler="Millenium.Controls.Selector.remove(gridDisponibles, gridSeleccionados);" />
</Listeners>
</ext:Button>
</Items>
</ext:Panel>
<ext:Panel runat="server" Height="32" Padding="10" Border="false" Draggable="false">
<Items>
<ext:Button ID="btnRemoveAll" runat="server" Icon="ResultsetFirst" ToolTip="<%$ AppRecursos : sm_txt_borrarTodos %>">
<Listeners>
<Click Handler="Millenium.Controls.Selector.removeAll(gridDisponibles, gridSeleccionados);" />
</Listeners>
</ext:Button>
</Items>
</ext:Panel>
<ext:Panel runat="server" RowHeight="0.5" Border="false" Draggable="false" />
</Items>
</ext:Panel>
</Center>
<East Split="true">
<ext:Panel runat="server" ID="panelSeleccionados" Layout="Fit" Draggable="false"
Border="false">
<Items>
<ext:GridPanel runat="server" ID="gridSeleccionados" AutoScroll="true" Draggable="false"
EnableDragDrop="false" AutoExpandColumn="Nombre">
<Store>
<ext:Store runat="server" ID="dsSeleccionados" AutoLoad="true">
<Proxy>
<ext:HttpProxy Url='<%# Model.RutaSeleccionados %>' Method="GET" AutoDataBind="true" />
</Proxy>
<SortInfo Field="Nombre" Direction="ASC" />
<Reader>
<ext:JsonReader IDProperty="CodigoInterno" Root="data">
<Fields>
<ext:RecordField Name="CodigoInterno" />
<ext:RecordField Name="Nombre" />
</Fields>
</ext:JsonReader>
</Reader>
<Listeners>
<Load Handler="Millenium.Controls.Selector.refreshLinkedControls();" />
</Listeners>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column ColumnID="Nombre" Header="<%$ AppRecursos : sm_txt_seleccionados %>"
DataIndex="Nombre">
<Renderer Handler="return Ext.util.Format.htmlEncode(value);" />
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel SingleSelect="false" />
</SelectionModel>
<Listeners>
<CellDblClick Handler="Millenium.Controls.Selector.remove(gridDisponibles, gridSeleccionados);" />
</Listeners>
</ext:GridPanel>
</Items>
</ext:Panel>
</East>
</ext:BorderLayout>
</Items>
<KeyMap>
<ext:KeyBinding>
<Keys>
<ext:Key Code="LEFT" />
</Keys>
<Listeners>
<Event Handler="#{btnRemove}.fireEvent('click');" />
</Listeners>
</ext:KeyBinding>
<ext:KeyBinding>
<Keys>
<ext:Key Code="RIGHT" />
</Keys>
<Listeners>
<Event Handler="#{btnAdd}.fireEvent('click');" />
</Listeners>
</ext:KeyBinding>
</KeyMap>
</ext:Panel>
</Center>
</ext:BorderLayout>
<ext:Hidden ID="hSelectedItemsStore" runat="server" Text="<%# Model.SelectedItemsStore %>" AutoDataBind="true" />
<ext:Hidden ID="hLinkedControls" runat="server" Text="<%# Model.LinkedControls %>" AutoDataBind="true" />
And the controller which manage it:public ActionResult CustomGridSelector(string containerId, string rutaSeleccionado, string rutaDisponibles, string selectedItemsStore, string linkedControls = null)
{
Ext.Net.MVC.PartialViewResult pr = new Ext.Net.MVC.PartialViewResult(containerId, Ext.Net.RenderMode.AddTo);
pr.ViewData.Model = new Softmachine.Millenium.Presentation.Web.MVC.Client.Helpers.WebControls.CustomGridSelector()
{
RutaDisponibles = rutaDisponibles,
RutaSeleccionados = rutaSeleccionado,
SelectedItemsStore = selectedItemsStore,
LinkedControls = linkedControls
};
return pr;
}
Any idea of this behaviour?