Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

In my problem is the exported excel link doesn't redirected. Actually i have a datagrid which maintain some values and i have the export to excel option. I can export the grid value to excel. But after exporting, whenever i click the particular id it should redirect to website. This is my code to export to excel , can anyone help me to direct the excel content.

C#
void ExportToExcel(GridGroupingControl grid)
       {


           try
           {
               GroupingGridExcelConverter.GroupingGridExcelConverterControl converter = new GroupingGridExcelConverter.GroupingGridExcelConverterControl();
               SaveFileDialog saveFileDialog = new SaveFileDialog();
               saveFileDialog.Filter = "Files(*.xls)|*.xls";
               saveFileDialog.DefaultExt = ".xls";
               saveFileDialog.FileName = "Forum List";
               if (saveFileDialog.ShowDialog() == DialogResult.OK)
               {

                   this.Cursor = Cursors.AppStarting;
                   converter.QueryImportExportCellInfo += new GridExcelConverter.GridImportExportCellInfoEventHandler(converter_QueryImportExportCellInfo);
                   converter.GroupingGridToExcel(grid, saveFileDialog.FileName, GridExcelConverter.ConverterOptions.Default);
                   this.Cursor = Cursors.Default;
                   System.Windows.Forms.DialogResult dialogResult = MessageBox.Show("Report saved as " + saveFileDialog.FileName + ". Do you want to open it now?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                   if (dialogResult.ToString().ToLower().Equals("yes"))
                   {
                       System.Diagnostics.Process.Start(saveFileDialog.FileName);
                   }
               }
           }
           catch (Exception exc)
           {
               this.Cursor = Cursors.Default;
               MessageBox.Show("Please close the Excel file opened with the same name and try again!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
               _error.LogMessageToFile("Error occured in Forum Viewer-ExportToExcel() due to " + exc.StackTrace);
           }


Thanks in Advance.
Arunkumar M
Posted
Updated 23-Apr-14 7:41am
v3

1 solution

first of all, I assume that you mean excel does not "open a website", for "redirection" is a browser, or more precise, a http response related thing and has nothing to do with your grid or excel.
my second guess is, that you are trying to attach a link to an id (maybe the column number!?). so there maybe 3 pitfalls:
1) I got you wrong and there is a url resolution issue like a real redirect issue, or broken relative links, etc.
2) you choose the wrong column type in you grind and the link is not exported as such, e.g. only the id gets exported. in this case the export of your Syncfusion component is broken (because of you) or not supported (because of them lazy bones)
3) the conversion of the column IS or HAS to be coded by your self. in the fist case, you assembled an invalid link or, second case, you did not specify the transformation for that column, so the Syncfusion component makes a guess or takes a default (obviously the wrong one) transformation method like object{id: integer, link: string} get output as object.id (by default first property or primary key is chosen).

hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900