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

[Solved] Grid is not rebinding

3 Answers 159 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jignesh
Top achievements
Rank 1
Jignesh asked on 30 Nov 2008, 10:48 PM
Hello,

I have grid with row selection using check box column. with button click i am updating status for selected records at databas side and saving one file on sever which i am downloading after database work. I need to rebind grid once file is downloaded at client side. But after file download its not executing command grid.rebind()

Here is my code

errStr = _ach.UpdateACHStatus(dtACH);
View.DownloadACHFile(sACHFileName, true);
rgACH.rebind();

 

 

Here is the code for download file

 

        public void DownloadACHFile(string fname, bool forceDownload)  
        {  
            string path = MapPath(fname);  
            string name = Path.GetFileName(path);  
            string ext = Path.GetExtension(path);  
            string type = "";  
            if (ext != null)  
            {  
                switch (ext.ToLower())  
                {  
                    case ".htm":  
                    case ".html":  
                        type = "text/HTML";  
                        break;  
 
                    case ".txt":  
                        type = "text/plain";  
                        break;  
 
                    case ".doc":  
                    case ".rtf":  
                        type = "Application/msword";  
                        break;  
                }  
            }  
            if (forceDownload)  
            {  
                Response.AppendHeader("content-disposition",  
                     "attachment; filename=" + name);  
            }  
            if (type != "")  
                Response.ContentType = type;  
            Response.WriteFile(path);  
            Response.End();  
        }  
 

 

 

 

 

I need to refresh grid once download process completes. But somehow rgACH.Rebind(); is not getting executed.

Please help.

Thanks.

 

 

 

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 01 Dec 2008, 12:16 PM
Hello Jignesh,

To avoid duplicate posts, we can continue our communication on the subject in the support ticket that you have opened on the matter.

All the best,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Sylvain
Top achievements
Rank 1
answered on 15 Jul 2009, 04:04 PM
Could the solution to this be posted? Thanks!
0
Sebastian
Telerik team
answered on 17 Jul 2009, 08:18 AM
Hello Sylvain,

I am pasting the reply my colleague Yavor provided for your reference:

The reason for this is that you are calling response end. In this case the code will not be executed.
You will achieve the same result with a standard gridview control.

Another option you may consider, is to open a separate page and handle the file download. If you are using Ajax, please refer to the following
post, as well as this article.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Jignesh
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Sylvain
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or