[CLOSED] FileUploadField in gridPanel cell?

  1. #1

    [CLOSED] FileUploadField in gridPanel cell?

    Hi,

    I'm trying to create a grid which allows me to attach two files, a very simply sample:

        <script runat="server">
            protected void Page_Load(object sender, EventArgs e) {
                if (!X.IsAjaxRequest) {
                    Store1.DataSource = new object[] 
                { 
                    new object[] { "group1", "1", "1" },
                    new object[] { "group1", "11", "11" },
                    new object[] { "group1", "111", "111" },
                    new object[] { "group2", "2", "2" },
                    new object[] { "group2", "22", "22" },
                    new object[] { "group2", "222", "222" },
                };
                    Store1.DataBind();
                }
            }
        </script>
        <form id="Form1" runat="server">
        <ext:Store ID="Store1" runat="server" GroupField="groupId">
            <Reader>
                <ext:ArrayReader>
                    <Fields>
                        <ext:RecordField Name="groupId" />
                        <ext:RecordField Name="test1" />
                        <ext:RecordField Name="test2" />
                    </Fields>
                </ext:ArrayReader>
            </Reader>
        </ext:Store>
        <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true" StoreID="Store1">
            <TopBar>
                <ext:Toolbar ID="Toolbar1" runat="server">
                    <Items>
                        <ext:Button ID="Button1" runat="server" Icon="Disk" Text="Save">
                            <DirectEvents>
                                <Click Url="/Home/SaveGrid" IsUpload="true" />
                            </DirectEvents>
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
            </TopBar>
            <ColumnModel ID="ColumnModel1" runat="server">
                <Columns>
                    <ext:Column Header="GroupId" DataIndex="groupId" />
                    <ext:Column Header="Test1" DataIndex="test1">
                        <Editor>
                            <ext:FileUploadField ID="FileUploadField1" runat="server" Icon="Attach">
                                <Listeners>
                                    <FileSelected Handler="GridPanel1.stopEditing();" />
                                </Listeners>
                            </ext:FileUploadField>
                        </Editor>
                        <EditorOptions AllowBlur="false" />
                    </ext:Column>
                    <ext:Column Header="Test2" DataIndex="test2">
                        <Editor>
                            <ext:FileUploadField ID="BasicField" runat="server" Icon="Attach">
                                <Listeners>
                                    <FileSelected Handler="GridPanel1.stopEditing();" />
                                </Listeners>
                            </ext:FileUploadField>
                        </Editor>
                        <EditorOptions AllowBlur="false" />
                    </ext:Column>
                </Columns>
            </ColumnModel>
        </ext:GridPanel>
        </form>
    I have got the fileUploadField to show up ok.. but when I POST, ASP.NET shows:


    +        AllKeys    {string[2]}    string[]
    .. which is good, as it has picked up both, but:


    -        Request.Files[0]    {System.Web.HttpPostedFileWrapper}    System.Web.HttpPostedFileBase {System.Web.HttpPostedFileWrapper}
    +        [System.Web.HttpPostedFileWrapper]    {System.Web.HttpPostedFileWrapper}    System.Web.HttpPostedFileWrapper
            ContentLength    0    int
            ContentType    "application/octet-stream"    string
            FileName    ""    string
    +        InputStream    {System.Web.HttpInputStream}    System.IO.Stream {System.Web.HttpInputStream}
    The FileName property (in both files) is empty. Is there a limitation in using FileUploadFields in a gridpanel? Is there a way round this? basically for each record in our grid we need to attache two files to that record.

    Thanks,
    Peter
    Last edited by Daniil; Nov 29, 2011 at 4:03 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Unfortunately, GridPanel doesn't support a FileUploadField as a Column's Editor. It's too specific field.

    And we can't see any workaround for that to get it working.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi,

    Unfortunately, GridPanel doesn't support a FileUploadField as a Column's Editor. It's too specific field.

    And we can't see any workaround for that to get it working.
    Ah, ok thanks for confirming. Do you think if we used a RowExpander with an embedded FormPanel & FileUploadField this would work ok?
  4. #4
    It would work if:

    1. Upload before RowExpander collapsing.

    2. Call the FileUploadField's reset method before new uploading.
  5. #5
    Quote Originally Posted by Daniil View Post
    It would work if:

    1. Upload before RowExpander collapsing.

    2. Call the FileUploadField's reset method before new uploading.
    I tested the RowExpander and see it works as you describe. We'll probably try and do something else then to try and get the result we want, but thanks for for helping.
  6. #6
    Can we mark the thread as closed?
  7. #7
    Yes, sorry. Thanks.

Similar Threads

  1. Replies: 1
    Last Post: Jul 10, 2012, 11:16 AM
  2. [CLOSED] FileUploadField + GridPanel paging
    By mcfromero in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Mar 20, 2012, 5:00 PM
  3. Gridpanel and Fileuploadfield issues
    By phmeneguelli in forum 1.x Help
    Replies: 3
    Last Post: Dec 23, 2011, 10:54 PM
  4. [CLOSED] FileUploadField in GridPanel
    By kenanhancer in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 20, 2011, 2:43 PM
  5. Replies: 0
    Last Post: Aug 30, 2011, 2:48 PM

Tags for this Thread

Posting Permissions