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

Multiple RadGrids

1 Answer 43 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 25 Sep 2018, 01:14 PM

I have a question that is pretty basic, but for me as a new developer it's hard to figure this out.

I will try to explain it as good as i can.

I have 3 different .aspx pages where i have different RadGrid tables. And in each of them i have made Excel export available. I have made aspx.cs code in each of them but now i'm trying to put everything in just on class. My problem is that i don't know how to make a method that can get the ExportSettings to work for each of the RadGrids. 

 

This is my method i made in the new class and "gvShipmentList" ist the name on one of my RadGrids. What do i have to do so i can reach all of my RadGrids through this method?

------------------------------------------

public static void ExportExcelOnItemCommand(object sender, GridCommandEventArgs e) {
            if (e.CommandName == RadGrid.ExportToExcelCommandName)
            {
                
                gvShipmentList.ExportSettings.FileName = "ShipmentList";
                gvShipmentList.ExportSettings.ExportOnlyData = true;
                gvShipmentList.ExportSettings.IgnorePaging = true;
                gvShipmentList.ExportSettings.OpenInNewWindow = true;

                gvShipmentList.GridLines = GridLines.Both;

                foreach (GridColumn column in gvShipmentList.MasterTableView.Columns)
                {
                    column.Visible = column.Display;
                }

                gvShipmentList.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
                gvShipmentList.MasterTableView.ExportToExcel();
            }
        }

-------------------------------

I hope someone can help me, and please, if i haven't given enough information then tell me so i can provide you with more. Like i said, i'm very new at this and trying to learn. But this was too hard.

 

Kind regards Tim

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 03 Oct 2018, 12:59 PM
Hi Tim,

One option would be to use control adatper (see ControlAdapter Class and WebControlAdapter Class). Another option you could use is ASP.NET Themes and Skins.
Attached you can find a sample showing an example of using ControlAdapter for Grid.

I hope this will be helpful.

Kind regards,
Attila Antal
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
Tim
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Share this question
or