[CLOSED] Refresh problem with PartialViewResult

  1. #1

    [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


  2. #2

    RE: [CLOSED] Refresh problem with PartialViewResult

    Hi,

    You have to set CloseAction="Close" for the window in the UploadFileEditor
  3. #3

    RE: [CLOSED] Refresh problem with PartialViewResult

    It doesn't work.

    The second time I open the window I get an error (the window is null). Probably CloseAction="Close" destroy the window.


    Bye,
    Stefano


  4. #4

    RE: [CLOSED] Refresh problem with PartialViewResult

    Hi,

    In this case you have to destroy it manually in the Before handler of DirectEvent


    [CODE]<Click Url="/Test/UploadFileList" Before="Ext.net.ResourceMgr.destroyCmp('UploadFile Editor');">/code]
  5. #5

    RE: [CLOSED] Refresh problem with PartialViewResult



    Hi Vladimir,

    it works fine.

    Thanks,
    Stefano

Similar Threads

  1. [CLOSED] Universal PartialViewResult Problem
    By tiramisu in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Dec 28, 2010, 1:27 PM
  2. Problem with GMapPanel in MVC2 using PartialViewResult
    By tiramisu in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Nov 23, 2010, 7:56 AM
  3. [CLOSED] PartialViewResult and Store refresh
    By tiramisu in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: May 20, 2010, 4:48 AM
  4. [CLOSED] PartialViewResult Problem
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 27, 2010, 11:15 AM
  5. Problem with combobox - On store refresh
    By Kaido in forum 1.x Help
    Replies: 2
    Last Post: Mar 05, 2009, 12:50 PM

Posting Permissions