Rad Grid Export To Excel

65 posts, 0 answers
  1. Arvind
    Arvind avatar
    40 posts
    Member since:
    Sep 2010

    Posted 08 Oct 2010 Link to this post

    Hi Telerik Team,

    I Have a rad Grid i have a column which is link button it is added Dynamically, When i click the Export to Excel button the Column which is made as Link Button is not being Exported to the Excel Sheet.I am Attaching the Excel Sheet and Rad Grid Images.
     

    Thanks,
    Chary
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Oct 2010 Link to this post

    Hello Arvind,

    Set the  ExportSettings ->  ExportOnlyData property to True to include the controls in the exported file.


    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Arvind
    Arvind avatar
    40 posts
    Member since:
    Sep 2010

    Posted 08 Oct 2010 Link to this post

    Hi,

    I have Set the ExportOnlyData="true" for RadGrid but it is not Working.

    Thanks,
    Chary.
  5. Arvind
    Arvind avatar
    40 posts
    Member since:
    Sep 2010

    Posted 08 Oct 2010 Link to this post

    Hi Shinu,

    I have set the property "ExportOnlyData = True" for the Rad Grid Even though the Custom column that is created dynamically is not being exported to the Excel sheet.
    Please Help me.

    Thanks,
    Arvind.
  6. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Oct 2010 Link to this post

    Hello,


    I am sorry that I mistyped that it to "True". What I meant is setting the property to "false" in order to include the controls when exporting. The ExportOnlyData property, as the name says, this property is helpful when you want to export only the data or the controls in grid.
    Overview

    Can someone from Telerik give us a hand in getting this solved?


    -Shinu.
  7. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 12 Oct 2010 Link to this post

    Hello guys,

    RadGrid's ExcelML engine generates the file directly from the data in the datasource. This means that the non-bound columns will not be exported.
    If this is a custom column that does not exist in your datasource you should add it manually to the ExcelML structure. I attached a simple project that demonstrates how to export template columns.

    Best regards,
    Daniel
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Patrik Johansson
    Patrik Johansson avatar
    270 posts
    Member since:
    May 2010

    Posted 01 Nov 2010 Link to this post

    Can someone please explain the logic behind having the ExportOnlyData = True to actually not just export the data, but also the controls, as is being said in this thread?? Seems very strange. Even more strange is that Telerik themselves write:

    • ExportOnlyData

    As the name says, this property is helpful when you want to export only the data - e.g. to exclude the controls from the exported file.


    Finally, it seem like the setting doesn't really do anything, we have the HTML format specified and get the "Edit" button included no matter if we set ExportOnlyData to true or false. Is this a bug?
  9. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 05 Nov 2010 Link to this post

    Hello Patrik,

    I attached a simple project that demonstrates the purpose of the ExportOnlyData property. Please test it on your end and let me know whether it behaves as explained in the documentation.

    Regards,
    Daniel
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. Arvind
    Arvind avatar
    40 posts
    Member since:
    Sep 2010

    Posted 26 Nov 2010 Link to this post

    Hi i am implemented radgrid filter in my code.

    I do the following steps:

    Provide search condition

    Click on Go button, the radgrid is populated with the search result

    Give filter condidtion and click on the filter button. The grid result set is filtered.

    Now when I provide a new search condition and click on the Go button, the radGrid is populated but the filter condidtion provided in the previous case in not cleared.

    Can someone provide me the code to clear the filter expression ???

    It is extremely urgent.

    Thanks & Regards
    N Arvind Chary.

  11. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 26 Nov 2010 Link to this post

    Hello Arvind,

    Try the following code snippet to clear the FilterExpression and value in filter TextBox.

    C#:
    foreach (GridColumn column in RadGrid1.MasterTableView.Columns)
       {
            column.CurrentFilterFunction = GridKnownFunction.NoFilter;
            column.CurrentFilterValue = string.Empty;
       }
       RadGrid1.MasterTableView.FilterExpression = string.Empty;
       RadGrid1.MasterTableView.Rebind();

    Also plese take a look at the following demo which shows how to clear filter.
    Grid / Google-like Filtering

    Thanks,
    Princy.
  12. Arvind
    Arvind avatar
    40 posts
    Member since:
    Sep 2010

    Posted 26 Nov 2010 Link to this post

    Hi Telerik team,

    I have radGrid Which consists of a Link button, on clicking the Link button in the RadGrid a Ajax Modal Pop-up will be opened and the Modal Pop-up consists of a RadGrid, by default i have set the AllowFilteringByColumn="True" for the Grid in modal pop-up when user the enters his filter criteria and Selects the filter, the Modal Pop-up is being dis-appeared, but it should not dis-appear.

    Can someone provide me the code ???

    It is extremely urgent.


    Please help me urgent.

    Thanks & Regards,
    N Aravinda Chary.
  13. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 13 Jun 2014 in reply to Daniel Link to this post

    i an using ur zip code
    its work nice 
    i am exporting radgrid in excel
    how to export radgrid in excel without OnNeedDataSource
    i am binding datasource to radgrid on button click event 
    if i am not use OnNeedDataSource,it give me object reference is null
    my code for binding grid is 
     grd_firstchart_aco.DataSource = table;
     grd_firstchart_aco.DataBind();
  14. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 17 Jun 2014 in reply to Shinu Link to this post

    hi shinu

    i am exporting heirarchy radgrid in excel

    how to export radgrid in excel without OnNeedDataSource

    i am binding datasource to radgrid on button click event 

    if i am not use OnNeedDataSource,it give me object reference is null

    my code for binding grid is 

     grd_firstchart_aco.DataSource = table;

     grd_firstchart_aco.DataBind();
    and code for export to excel is below
      grd_forth_aco.ExportSettings.ExportOnlyData = true;
            grd_forth_aco.ExportSettings.IgnorePaging = true;
            grd_forth_aco.ExportSettings.OpenInNewWindow = true;
            grd_forth_aco.ExportSettings.FileName = "fileName";
            grd_forth_aco.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
            grd_forth_aco.ExportSettings.HideStructureColumns = true;

            grd_forth_aco.MasterTableView.HierarchyDefaultExpanded = true;
            grd_forth_aco.MasterTableView.DetailTables[0].HierarchyDefaultExpanded = true;

            grd_forth_aco.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;
            grd_forth_aco.MasterTableView.DetailTables[0].HierarchyLoadMode = GridChildLoadMode.Client;

            grd_forth_aco.MasterTableView.ExportToExcel();
    thanks
  15. Kostadin
    Admin
    Kostadin avatar
    1709 posts

    Posted 18 Jun 2014 Link to this post

    Hello Asutosh,

    Note that we strongly recommend to use advanced data-binding through NeedDataSource event when perform complex operations such hierarchy and export. Even if you manage to export the grid I could not be sure whether the export output will display all the information of the grid and whether the correct format will be applied.

    Regards,
    Kostadin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  16. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 18 Jun 2014 in reply to Kostadin Link to this post

    thanks for your reply
    in my case there is not possible to use onneeddatasource
    i have to bind my data on page load event
    i am able to export my rad hierarchy grid to export as excel 
    but there is pagging also showing
    i have attached error image 
    and my code for export to excel is below
      foreach (GridDataItem item in grd_forth_aco.MasterTableView.Items)
            {
              
              item.Expanded = true;
            }
            grd_forth_aco.ExportSettings.OpenInNewWindow = true;
            grd_forth_aco.MasterTableView.ExportToExcel();
  17. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 Jun 2014 in reply to Asutosh Link to this post

    Hi Asutosh,

    Why you have mentioned that you can't do the binding in OnNeedDataSource, can you please elaborate your requirement for  further help?

    Thanks,
    Shinu.
  18. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 19 Jun 2014 in reply to Shinu Link to this post

    hi 
    in my scenario
    i have one chart and radgrid
    i fill chart and according to fill grid on page load 
    and also i can give filter in my chart and according to that grid will fill
    so the problem is that filter can not work in that 
    because after filter apply on grid onneeddatasource is called so it get refresh
  19. Kostadin
    Admin
    Kostadin avatar
    1709 posts

    Posted 20 Jun 2014 Link to this post

    Hello Asutosh,

    I am afraid that the Export feature works only with advanced data-binding. Nevertheless you could still use this type of binding in your scenario. Simply you need to remove the filter option from the grid and use only chart to filter the datasource. Generally you will assign the filtered datasource to the grid OnNeedDataSource event handler instead on Page_Load.

    Regards,
    Kostadin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  20. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 20 Jun 2014 in reply to Kostadin Link to this post

    we have filter on chart itself and when we click show data button on toolbar above each chart it opens radgrid in radwindow popup. and we see only filtered data in our grid and chart both. can you give any example as we are opening radwindow on click of button. 

    what i am not able to understand is i am getting only filtered data in my chart and grid both than why i am not able to export that grid with filtered data to excel or pdf  ?
  21. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 22 Jun 2014 Link to this post

    can anybody please reply. we have deadline for our project.
  22. SANJAY
    SANJAY avatar
    61 posts
    Member since:
    Jun 2012

    Posted 22 Jun 2014 in reply to Asutosh Link to this post

    Hi Aushotosh

    I may not have got  the complete picture

    Problem 1: You cannot used need datasource as an apply filter the grid refreshes and all data is included in the grid

    Answer : Store the recordset which populates the grid in session object. On apply filter condition store the filtered recordsets in the session object. In need datasource read the session object and populate the grid. If this is the basic problem then probably this will solve your problem

    I am based in India. If I can help you with the project I would do that. In case this doesnot solve your problem. Post the code of page and need on this post and would try and help you.


    Regards


    Sanjay
  23. SANJAY
    SANJAY avatar
    61 posts
    Member since:
    Jun 2012

    Posted 22 Jun 2014 in reply to SANJAY Link to this post

    I would not need your database connection or credentials. What you can do is that the recordset that you are populating you could save as

    rs.tables(0).writexmlschema("C:\sch.xml")
    rs.tables(0).writexml("C:\data.xml")

    for the purpose of populationg with your data I would use those two files


    Regards
  24. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 22 Jun 2014 in reply to Kostadin Link to this post

    hi
    i have put radgrid in div
    if the div is visible false can radgrid onneeddatasource event call?
  25. SANJAY
    SANJAY avatar
    61 posts
    Member since:
    Jun 2012

    Posted 23 Jun 2014 in reply to Asutosh Link to this post

    Hi Aushotosh

    Even if the div is visible false the RadGrid Need Datasource will be called

    You can give id to div and runat server

    In the first line of radGrid need datasource Check on server side if Div is visible or not. If Div is not visible do exit sub. You would save resources and also achieve the needful
  26. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 23 Jun 2014 in reply to SANJAY Link to this post

    thanks for your reply
  27. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 23 Jun 2014 in reply to SANJAY Link to this post

    thanks for your reply 
    but in my case its not woking 
    when my div is visible then its work
    but when it hide its not working
  28. SANJAY
    SANJAY avatar
    61 posts
    Member since:
    Jun 2012

    Posted 23 Jun 2014 in reply to Asutosh Link to this post

    Dear Aushutosh

    Kindly check if

    a) Div has tag runat=server and it has a id
    b) I guess you are changing the visibitlity of Div on client side. Be sure that it changes the visibility on client side

    c) A turnaround. Put a hiddenfield let us say dv. When on client side you hide the div set value of dv = 2, when you make the div visible set value to dv =1

    Then in NeedDatasource check value of dv . if Dv.Value = 2 then exit sub

    In all probability you are not able to read the vaule of visibility in the post back

    Hope this works

    Regards
  29. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 23 Jun 2014 in reply to SANJAY Link to this post

    hi
    i have schenario like this
    i have rad chart and rad grid
    i have show data button for grid show
    now in this 
    m binding radchart data on page load and grid data on needdatasource event
    when page load only chart will display 
    and when i click on show data grid will show,now issue is that i first my rad grid is in div which is visible false 
    so onneeddatasource event is not called

    and when i click on show data grid will show







  30. SANJAY
    SANJAY avatar
    61 posts
    Member since:
    Jun 2012

    Posted 23 Jun 2014 in reply to Asutosh Link to this post

    Ashutosh

    My advice is

    a) Bind Radchart on PageLoad
    b) Add a hiddenfld dv on page with default value of 1 and grid should be invisible
    c) in Need datasource if dv= 1 exit sub
    d) On button show event Server side change value of dv =2 and change visibility of grid
    e) If grid doesnot load then call .Grid.rebind on button click

    Actually I am a practising surgeon. You could send me the form and xml files as suggested earlier I will execute the page and give back (hopefully)


    Regards


  31. Asutosh
    Asutosh avatar
    130 posts
    Member since:
    Sep 2013

    Posted 23 Jun 2014 in reply to SANJAY Link to this post

    actually problem is that onneeddatasource is called before button click event
    thats y i cant do that
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017