This is a migrated thread and some comments may be shown as answers.

Client file Save in Grid

0 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Timyr
Top achievements
Rank 1
Timyr asked on 21 Jul 2011, 10:25 AM
Hello! I'm having this problem (I need at the click of a button to save the file on the client side. The button is in editformsettings in Grid! 
<asp:Button ID="ButSave" runat="server" Text="Save" CommandName="SaveAnket"/> 
Grid event! 
 
void Grid_ItemCommand (object sender, GridCommandEventArgs e) 
        

                
if (e.CommandName == "SaveAnket") 
                

                    
SaveBlankOnClient (); 
                

       

 
protected void SaveBlankOnClient () 
        

            
string filename = "TextFile.txt"; 
            
string longPath = MapPath (filename); 
            
Response.ContentType = "APPLICATION / OCTET-STREAM"; 
            
string disHeader = "Attachment; Filename = \" "+ filename +" \ ""; 
            
Response.AppendHeader ("Content-Disposition", disHeader); 
            
System.IO.FileInfo fileToDownload = new System.IO.FileInfo (longPath); 
            
Response.Flush (); 
            
Response.WriteFile (longPath); 
            
Response.End (); 
        


This operation does not work for me from the grid ... But in an ordinary button, it saves the file! I understand this is due to postback? 
How save file from the GridHelp please)))

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Timyr
Top achievements
Rank 1
Share this question
or