Jul 01, 2010, 12:21 PM
[CLOSED] Refresh problem with PartialViewResult
Hi,
this post is linked to the Post #35627. I prefer to write a new post to clarify the problem.
This is the situation:
- I'm in an MVC application
- I start from a grid panel
- I select a row of the grid and then I press a toolbar botton that call a DirectEvent:
<DirectEvents>
<Click Url="/Test/UploadFileList">
<ExtraParams>
<ext:Parameter Name="baseTableId" Value="100" />
<ext:Parameter Name="baseTablePKId" Value="gCurrentPKId" Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
the DirectEvent call a controller action returning a PartialViewResult:
public Ext.Net.MVC.PartialViewResult UploadFileList(int baseTableId, int baseTablePKId)
{
Ext.Net.MVC.PartialViewResult pvr = new Ext.Net.MVC.PartialViewResult();
pvr.ViewData["BaseTableId"] = baseTableId.ToString();
pvr.ViewData["BaseTablePKId"] = baseTablePKId.ToString();
return pvr;
}
this is the UploadFileList.ascx view containing a GridPanel and a reference to an ascx control (UploadFileEditor.ascx):
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register src="UploadFileEditor.ascx" tagname="UploadFileEditor" tagprefix="upl" %>
<ext:Window
ID="UPLListWindow"
Modal="true"
runat="server"
Title="Allegati"
Icon="DiskUpload"
Width="640"
Height="400"
MinWidth="320"
MinHeight="200"
Layout="fit"
CloseAction="Close"
Closable="true">
<Items>
<ext:GridPanel
ID="UPLGridPanel"
runat="server"
Header="false"
Border="false"
TrackMouseOver="true"
AutoExpandColumn="AttachmentName">
<Store>
<ext:Store ID="dsAttachments" runat="server" AutoLoad="true">
<Proxy>
<ext:HttpProxy Url="/Test/GetAttachmentList/" />
</Proxy>
<Reader>
<ext:JsonReader IDProperty="AttachmentId" Root="data">
<Fields>
<ext:RecordField Name="AttachmentId" Type="Int" />
<ext:RecordField Name="BaseTableId" Type="Int" />
<ext:RecordField Name="BaseTablePKId" Type="Int" />
<ext:RecordField Name="AttachmentFileName" />
<ext:RecordField Name="AttachmentName" />
<ext:RecordField Name="Notes" />
</Fields>
</ext:JsonReader>
</Reader>
<BaseParams>
<ext:Parameter Name="baseTableId" Value='#{hiddenBaseTableId}.getValue()' Mode="Raw" />
<ext:Parameter Name="baseTablePKId" Value='#{hiddenBaseTablePKId}.getValue()' Mode="Raw" />
</BaseParams>
<SortInfo Field="AttachmentName" Direction="ASC" />
</ext:Store>
</Store>
<ColumnModel ID="UPLColumnModel" runat="server">
<Columns>
<ext:Column ColumnID="AttachmentId" DataIndex="AttachmentId" Header="ID" Width="75" />
<ext:Column ColumnID="AttachmentName" DataIndex="AttachmentName" Header="Descrizione" />
<ext:Column ColumnID="AttachmentFileName" DataIndex="AttachmentFileName" Header="Nome File" Width="200"/>
</Columns>
</ColumnModel>
<TopBar>
<ext:Toolbar ID="UPLTopToolbar" runat="server" EnableOverflow="false">
<Items>
<ext:Button ID="UPLButtonAdd" runat="server" Text=" Nuovo" Icon="Add" ToolTip="Aggiunge una nuova Riga">
<Listeners>
<Click Handler="#{UploadFileEditor}.show();" />
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<SelectionModel>
<ext:RowSelectionModel ID="UPLRowSelectionModel" runat="server" />
</SelectionModel>
</ext:GridPanel>
<ext:Hidden
ID="hiddenBaseTableId"
runat="server"
Text='<%# ViewData["BaseTableId"] %>'
AutoDataBind="true" />
<ext:Hidden
ID="hiddenBaseTablePKId"
runat="server"
Text='<%# ViewData["BaseTablePKId"] %>'
AutoDataBind="true" />
</Items>
</ext:Window>
<upl:UploadFileEditor ID="UPLEditorWindow" runat="server" />
When the UPLButtonAdd is pressed, the control (containing a FormPanel) is displayed.
This is the UploadFileEditor.ascx code:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl"%>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<ext:Window
ID="UploadFileEditor"
runat="server"
Title="Nuovo Allegato"
Icon="DiskUpload"
Width="560"
Height="305"
Modal="true"
Hidden="true" AutoDoLayout="true"
AutoRender="false"
Resizable="false">
<Items>
<ext:FormPanel
ID="UPDEdtForm"
FormID="TheUploadFileForm"
runat="server"
Frame="false"
AutoHeight="true"
MonitorValid="true"
PaddingSummary="20px 10px 0 10px"
BodyStyle="background-color:transparent;"
Border="false"
LabelWidth="70"
FileUpload="true"
Url="/Test/SubmitFile/">
<Defaults>
<ext:Parameter Name="anchor" Value="100%" Mode="Value" />
</Defaults>
<Items>
<ext:FileUploadField
ID="UPDEdtFileUploadField"
Name="TheFileName"
runat="server"
AllowBlank="false"
EmptyText="Selezionare un file"
FieldLabel="File"
ButtonText=""
Icon="ImageAdd">
</ext:FileUploadField>
<ext:TextField
ID="AttachmentName"
runat="server"
AllowBlank="false"
FieldLabel="Titolo" />
<ext:TextArea
ID="AttachmentNotes"
runat="server"
FieldLabel="Descrizione"
Height="150"/>
</Items>
<Buttons>
<ext:Button ID="UPDEdtButtonSave"
runat="server"
Text="Submit Form"
Icon="Disk">
<Listeners>
<Click Handler="#{UPDEdtForm}.getForm().submit();" />
</Listeners>
</ext:Button>
<ext:Button ID="UPDEdtButton1"
runat="server"
Text="Upload File"
Icon="Disk">
<DirectEvents>
<Click Url="/Test/UploadFile" IsUpload="true" CleanRequest="true" Method="POST" FormID="TheUploadFileForm" />
</DirectEvents>
</ext:Button>
<ext:Button
ID="UPDEdtButtonReset"
runat="server"
Text="Reset"
Icon="ArrowUndo">
<Listeners>
<Click Handler="#{UPDEdtForm}.getForm().reset();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:FormPanel>
</Items>
</ext:Window>
So far, everything works fine. Now, if I close the last two windows, return to the main GridPanel and re-execute the same procedure (open the second grid and then the form), the last window is not displayed well. Moreover, I can't close the window using the "x" button.
I attached the images showing the problem.
Bye,
Stefano