Hey guys,

a few weeks ago, we bought some licences in our company for ext.net and now there comes up my first question :-)

I already looked up other threads here to find the answer but nothing helped for me.
the problem is the following:

i have a grid Panel that lists me the files of a folder with it's name, size, description etc. no problem. Now for each "file-row", i have a download "Button", which should download the file by clicking it:

<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<form runat="server">
    <ext:GridPanel 
        ID="folderContentGrid"
        runat="server"
        StripeRows="true"
        Title="Folder content"
        Layout="FitLayout"
        Height="500px"
        AutoScroll="true"
        >
        <Store>
            <ext:Store runat="server">
                <Reader>
                    <ext:ArrayReader>
                        <Fields>
                            <ext:RecordField Name="fileIcon" Type="String" />
                            <ext:RecordField Name="fileName" Type="String" />
                            <ext:RecordField Name="fileFullname" Type="String" />
                            <ext:RecordField Name="fileSize" Type="Int" />
                            <ext:RecordField Name="uploadDate" Type="Date" />
                            <ext:RecordField Name="description" Type="String" />
                        </Fields>
                    </ext:ArrayReader>
                </Reader>
            </ext:Store>
        </Store>
        <ColumnModel runat="server">
        
            <Columns>
                <ext:RowNumbererColumn />
                <ext:Column DataIndex="fileIcon" Header="Icon" Width="260px"/>
                <ext:Column DataIndex="fileName" Header="Name" Width="260px"/>
                <ext:Column DataIndex="fileFullname" Header="Fullname" Width="260px" Hidden="true"/>
                <ext:NumberColumn DataIndex="fileSize" Header="Size" Width="260px"/>
                <ext:DateColumn DataIndex="uploadDate" Header="UploadDate" Width="260px"/>
                <ext:Column DataIndex="description" Header="Beschreibung" Width="260px"/>
                <ext:CommandColumn Header="Download" Width="60">
                    <Commands>
                        <ext:GridCommand Icon="DiskDownload" CommandName="download">
                            <ToolTip Text="Download" />
                        </ext:GridCommand>
                    </Commands>
                </ext:CommandColumn>
            </Columns>
        </ColumnModel>
        <SelectionModel>
            <ext:RowSelectionModel ID="RowModel" runat="server" SingleSelect="true" />
        </SelectionModel>
        <Listeners>
            <Command Handler="Ext.net.DirectMethods.downloadFile(record.data.fileFullname);"/>
        </Listeners>
    </ext:GridPanel>
</form>
</body>
the DirectMethod "downloadFile" looks like that, i just tested it now for an Excel document, i know i will need a switch case for defining the Mime type of the document:

[DirectMethod]
        public void downloadFile(string filepath)
        {
            try
            {
                // filepath is now: C:/user/testuser/test.xls

                string type = "application/msexcel";
                String FilePath = filepath.Replace("/", "\\");
                String FileName = FilePath.Substring(FilePath.LastIndexOf("\\") + 1);

                // FilePath is now: C:\users\testuser\test.xls"
                // FileName is now: test.xls

                Response.ClearContent();
                Response.Clear();
                Response.Buffer = true;

                Response.ContentType = type;
                Response.AddHeader("Content-Type", type);
                Response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ";");
                Response.TransmitFile(FilePath);

                Response.Flush();
                Response.End();
            }
            catch (Exception ex)
            {
                X.Msg.Alert("error", "data not found").Show();
            }
        }
if i try that code, i get the error "BADRESPONSE: illegal character" .. i read that i need an IsUpload="true"..somewhere.. but could not find the right place for it by using a command handler for a Grid command.

I hope you can help me out here :-)

Best regards,
novacp.