Multiple RadGrids

2 posts, 0 answers
  1. Tim
    Tim avatar
    4 posts
    Member since:
    Sep 2018

    Posted 25 Sep Link to this post

    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

  2. Attila Antal
    Admin
    Attila Antal avatar
    135 posts

    Posted 03 Oct Link to this post

    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.
Back to Top