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

Rad Grid Export To Excel

64 Answers 1659 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Arvind
Top achievements
Rank 1
Arvind asked on 08 Oct 2010, 08:39 AM
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

64 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 08 Oct 2010, 10:24 AM
Hello Arvind,

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


-Shinu.
0
Arvind
Top achievements
Rank 1
answered on 08 Oct 2010, 12:26 PM
Hi,

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

Thanks,
Chary.
0
Arvind
Top achievements
Rank 1
answered on 09 Oct 2010, 04:18 AM
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.
0
Shinu
Top achievements
Rank 2
answered on 11 Oct 2010, 12:18 PM
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.
0
Daniel
Telerik team
answered on 12 Oct 2010, 09:46 PM
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
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 02 Nov 2010, 12:45 AM
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?
0
Daniel
Telerik team
answered on 05 Nov 2010, 10:45 PM
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
0
Arvind
Top achievements
Rank 1
answered on 26 Nov 2010, 06:24 AM

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.

0
Princy
Top achievements
Rank 2
answered on 26 Nov 2010, 06:44 AM
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.
0
Arvind
Top achievements
Rank 1
answered on 26 Nov 2010, 10:30 AM
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.
0
Asutosh
Top achievements
Rank 1
answered on 13 Jun 2014, 09:24 AM
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();
0
Asutosh
Top achievements
Rank 1
answered on 17 Jun 2014, 12:01 PM
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
0
Kostadin
Telerik team
answered on 18 Jun 2014, 06:54 AM
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.

 
0
Asutosh
Top achievements
Rank 1
answered on 18 Jun 2014, 07:28 AM
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();
0
Shinu
Top achievements
Rank 2
answered on 19 Jun 2014, 11:34 AM
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.
0
Asutosh
Top achievements
Rank 1
answered on 19 Jun 2014, 12:40 PM
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
0
Kostadin
Telerik team
answered on 20 Jun 2014, 12:32 PM
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.

 
0
Asutosh
Top achievements
Rank 1
answered on 20 Jun 2014, 12:57 PM
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  ?
0
Asutosh
Top achievements
Rank 1
answered on 22 Jun 2014, 06:52 AM
can anybody please reply. we have deadline for our project.
0
SANJAY
Top achievements
Rank 1
answered on 22 Jun 2014, 08:19 AM
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
0
SANJAY
Top achievements
Rank 1
answered on 22 Jun 2014, 08:21 AM
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
0
Asutosh
Top achievements
Rank 1
answered on 23 Jun 2014, 04:38 AM
hi
i have put radgrid in div
if the div is visible false can radgrid onneeddatasource event call?
0
SANJAY
Top achievements
Rank 1
answered on 23 Jun 2014, 05:23 AM
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
0
Asutosh
Top achievements
Rank 1
answered on 23 Jun 2014, 05:37 AM
thanks for your reply
0
Asutosh
Top achievements
Rank 1
answered on 23 Jun 2014, 07:01 AM
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
0
SANJAY
Top achievements
Rank 1
answered on 23 Jun 2014, 07:36 AM
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
0
Asutosh
Top achievements
Rank 1
answered on 23 Jun 2014, 07:46 AM
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







0
SANJAY
Top achievements
Rank 1
answered on 23 Jun 2014, 08:13 AM
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


0
Asutosh
Top achievements
Rank 1
answered on 23 Jun 2014, 08:21 AM
actually problem is that onneeddatasource is called before button click event
thats y i cant do that
0
SANJAY
Top achievements
Rank 1
answered on 23 Jun 2014, 08:26 AM
Ashutosh

Problem seems to be solved

When needdatasouruce is called then value of dv.value = 1 so it will exit sub

then on button click

dv.value=2
grid.visible = true
grid.rebind() This will call need datasource again and this time the dv.value = 2 so it wall the database

Now at end of the recordset

Me.session("grd") = rs

next time when it comes in need datasource then it will read from session object so will be faster


Regards

0
SANJAY
Top achievements
Rank 1
answered on 23 Jun 2014, 08:37 AM
It is ok

Post the code of aspx page and vb file here and I will make the necessary changes and sent to you

Regards
0
Asutosh
Top achievements
Rank 1
answered on 23 Jun 2014, 08:55 AM
my .aspx file code
      <div id="firstgrid" runat="server" visible="false">

                                                            <telerik:RadGrid ID="grd_firstchart_aco" runat="server" Width="99.5%" ShowStatusBar="true" AutoGenerateColumns="false"
                                                                AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="false" Skin="Silk"
                                                                OnDetailTableDataBind="grd_firstchart_aco_DetailTableDataBind">
                                                                <GroupingSettings CaseSensitive="false" />
                                                                <PagerStyle Mode="Slider"></PagerStyle>
                                                                <MasterTableView Width="100%" DataKeyNames="Gender,ACoId" AllowMultiColumnSorting="True">
                                                                    <DetailTables>
                                                                        <telerik:GridTableView Name="" Width="100%" AllowFilteringByColumn="true" PageSize="10" AllowPaging="true">
                                                                            <Columns>
                                                                                <telerik:GridBoundColumn SortExpression="Benehicno" HeaderText="Hic No." HeaderButtonType="TextButton"
                                                                                    DataField="Benehicno">
                                                                                </telerik:GridBoundColumn>
                                                                                <telerik:GridBoundColumn SortExpression="BeneName" HeaderText="Patient Name" HeaderButtonType="TextButton"
                                                                                    DataField="BeneName">
                                                                                </telerik:GridBoundColumn>
                                                                                <telerik:GridBoundColumn SortExpression="State" HeaderText="State" HeaderButtonType="TextButton"
                                                                                    DataField="State">
                                                                                </telerik:GridBoundColumn>
                                                                                <telerik:GridBoundColumn SortExpression="County" HeaderText="County" HeaderButtonType="TextButton"
                                                                                    DataField="County">
                                                                                </telerik:GridBoundColumn>
                                                                            </Columns>
                                                                        </telerik:GridTableView>
                                                                    </DetailTables>
                                                                    <Columns>
                                                                        <telerik:GridBoundColumn SortExpression="ACoId" HeaderText="ACoId" HeaderButtonType="TextButton"
                                                                            DataField="ACoId">
                                                                        </telerik:GridBoundColumn>
                                                                        <telerik:GridBoundColumn SortExpression="Gender" HeaderText="Gender" HeaderButtonType="TextButton"
                                                                            DataField="Gender">
                                                                        </telerik:GridBoundColumn>
                                                                        <telerik:GridBoundColumn SortExpression="CountBenehicNo" HeaderText="Count" HeaderButtonType="TextButton"
                                                                            DataField="CountBenehicNo">
                                                                        </telerik:GridBoundColumn>

                                                                    </Columns>
                                                                </MasterTableView>
                                                            </telerik:RadGrid>
                                                        </div>


my aspx.cs file code as below
 public void load_first_graph(string where)//for aco
    {
        try
        {
            pie.Visible = true;
            stackbar.Visible = false;
            string where1 = check_user();
            if (!string.IsNullOrEmpty(where))
            {
                where1 = where1 + " and " + where;
            }
            ViewState["count_check"] = 0;
            ViewState["first_grp"] = "group";
            hdnfield_firstchartclick.Value = "group";
            DataTable table1 = new DataTable();
            int id = 1;
            table1 = _obj_360PatientPopulationProfiledal.Fetch_All_patient_data_For_AllD(where1, id);
            Active_patient_count_chart.DataSource = table1;
            Active_patient_count_chart.PlotArea.XAxis.DataLabelsField = "AcoId";
            Active_patient_count_chart.PlotArea.Series[0].DataFieldY = "CountBenehicNo";
            Active_patient_count_chart.PlotArea.Series[0].TooltipsAppearance.ClientTemplate = "Active Patient Gender : " + "#= dataItem.Gender#" + ",</br> Total Count:" + "#= dataItem.CountBenehicNo#";

            // ViewState["Favorite_Query_Activepatientcount"] = "select CountBenehicNo=count(distinct ba.benehicno),ba.ACoId,Gender=case when SexCd=1 then 'M' else 'F' end from [dbo].[BeneficiaryAcoPhysicianRel] ba  inner join [dbo].[Beneficiary_Details] bd on ba.BenehicNo=bd.benehicno " + where1 + " group by ba.ACoId , case when SexCd=1 then 'M' else 'F' end order by AcoId";
            ViewState["Favorite_Query_Activepatientcount"] = "select DisplayData=count(distinct ba.benehicno),ba.ACoId as DisplayName,ba.Gender as [Group] from [dbo].[BeneficiaryAcoPhysicianRel] ba inner join [ACOData].[BeneCohortdata] bc on bc.benehicno=ba.benehicno " + where1 + " group by ba.ACoId , gender order by DisplayName"; ;
            ViewState["Favorite_ChartType_Activepatientcount"] = "PIE-STACKBARCHART";
            lblactivepatientcountheader.Text = "Active Patient Count by Gender by ACO";
            lblactivepatientcountheader.ToolTip = "Active Patient Count by Gender by ACO";

            patient_pop_profile_grdfirstgraph.DataSource = table1;
            patient_pop_profile_grdfirstgraph.DataBind();
            DataConvert_gridfisrt.DataSource = table1;
            DataConvert_gridfisrt.DataBind();

            int chekfavt = chekfavourite_filter(lblactivepatientcountheader.Text.ToString());
            if (chekfavt == 1)
            {
                btn_Favtchart_ActivePatientCountByGender_Grey.Visible = false;
                btn_Favtchart_ActivePatientCountByGender_Yellow.Visible = true;
            }
            else
            {
                btn_Favtchart_ActivePatientCountByGender_Grey.Visible = true;
                btn_Favtchart_ActivePatientCountByGender_Yellow.Visible = false;
            }

           
          //  this.GridGroupingControl1.DataSourceControlRowUpdating += new GridDataSourceControlRowUpdateEventHandler(this.RowUpdating);

           

            grd_firstchart_aco.DataSource = table1;
            grd_firstchart_aco.DataBind();

            UpdatePanel6.Update();
            updtpnlfirst_chart.Update();

        }
        catch (Exception ex)
        {
            throw ex;
        }

    }


  protected void grd_third_aco_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
    {
        GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;

        string where = null;

        string AcoId = dataItem.GetDataKeyValue("acoid").ToString();
        string filter = Convert.ToString(ViewState["patient_population_filter"]);
        if (string.IsNullOrEmpty(filter))
        {
            where = " where ba.acoid ='" + AcoId + "'";
        }
        else
        {
            where = " where ba.acoid ='" + AcoId + "' and " + filter;
        }
        Div_secondchart_firstgrid.Visible = true;
        Div_secondchart_secondgrid.Visible = false;
        Div_secondchart_thirdgrid.Visible = false;
        DataTable _dt1 = new DataTable();
        _dt1 = _obj_360PatientPopulationProfiledal.Fetch_All_Patient_Data_ThirdChart(where, 1);
        if (_dt1.Rows.Count > 0)
        {
            e.DetailTableView.DataSource = _dt1;

        }
        ScriptManager.RegisterStartupScript(this, typeof(Page), "Testing", "lnk_PatientAverageRiskScorebyYearbyACO_Showdata();", true);
        upd_third_data.Update();
    }

0
Asutosh
Top achievements
Rank 1
answered on 23 Jun 2014, 09:43 AM
hi kistdian
i have attached my complete schenarion here
can you tell me how i can use onneed datasource for gridview to excel export in my schenario

.aspx.cs code
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

public partial class radgridchartdemo : System.Web.UI.Page
{

    _360PatientPopulationProfiledal _obj_360PatientPopulationProfiledal = new _360PatientPopulationProfiledal();
    User_Chart_FavoriteDAL _objUser_Chart_FavoriteDAL = new User_Chart_FavoriteDAL();
    FinancialPerformanceDAL _objFinancialPerformanceDAL = new FinancialPerformanceDAL();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            fill_filter_of_group();
            fill_Costby_Genderby_Chronic_Disease_Aco(null, null, null);
        }

    }
    public void fill_Costby_Genderby_Chronic_Disease_Aco(string usertype, string wherecondition, string whereForPopup)
    {
        try
        {
            string user = null;
            string _where = null;
            int id = 0;
            string usertype_fourth = null;
            if (string.IsNullOrEmpty(usertype) && string.IsNullOrEmpty(wherecondition))
            {

                if (Session["AcoManager"] != null)   // For AcoManager Login  
                {
                    string acoid = Session["AcoManager"].ToString();
                    user = "where ba.Acoid ='" + acoid + "'";
                    id = 1;
                    usertype_fourth = "aco";
                }
                else if (Session["rolename"].ToString() == "ACOADMIN") // For Aco Login 
                {
                    string acoid = Session["ACOid"].ToString();
                    user = "where ba.AcoId ='" + acoid + "'";
                    id = 1;
                    usertype_fourth = "aco";
                }
                else if (Session["rolename"].ToString() == "PHYSICIAN")  // for participents 
                {
                    string acoid = Session["ACOParID"].ToString();
                    string query = "select ACOParNPI from [dbo].ACOParicipants where ACOPariD = '" + acoid + "'";
                    DataTable _dt = new DataTable();
                    _dt = _objUser_Chart_FavoriteDAL.FetchAll(query);
                    string acoparnpi = _dt.Rows[0]["ACOParNPI"].ToString();
                    user = "where ba.ACOParNPI ='" + acoparnpi + "'";
                    id = 3;
                    usertype_fourth = "participant";
                }
                else if (Session["rolename"].ToString() == "ACOPARTICIPANTSGROUP")  // for participents group
                {
                    string grpname = Session["group_tinlegalbuisenessname"].ToString();


                    user = "where TIN_LegalBusinessName ='" + grpname + "'";
                    id = 2;
                    usertype_fourth = "group";
                }
                else // For Idesigns 
                {
                    // When No chenge in Dropdown 


                }
                _where = user;
            }
            else
            {
                if (usertype == "participant")  // for participents 
                {
                    string query = "select ACOParNpi from [dbo].[ACOParicipants] where ACOPARFIRSTNAME+' '+AcoParLastName ='" + wherecondition + "'";
                    DataTable _dt = new DataTable();
                    _dt = _objUser_Chart_FavoriteDAL.FetchAll(query);
                    string acoparnpi = _dt.Rows[0]["ACOParNPI"].ToString();
                    user = "where ba.ACOParNPI ='" + acoparnpi + "'";
                    usertype_fourth = "participant";
                    id = 3;

                }
                else if (usertype == "group")  // for participents group
                {
                    string grpname = wherecondition;


                    user = "where TIN_LegalBusinessName ='" + grpname + "'";
                    id = 2;
                    usertype_fourth = "group";

                }
                else // For Idesigns 
                {
                    // When No chenge in Dropdown 


                }
                _where = user;
            }
            DataTable table1 = new DataTable();
            table1 = _obj_360PatientPopulationProfiledal.Fetch_All_Costby_Genderby_Chronic_Disease(_where, id);

            Costby_Gendeby_Chronic_Disease_Chart.DataSource = table1;
            Costby_Gendeby_Chronic_Disease_Chart.PlotArea.XAxis.DataLabelsField = "CohortName";
            Costby_Gendeby_Chronic_Disease_Chart.PlotArea.Series[0].DataFieldY = "TotalCost";
            Costby_Gendeby_Chronic_Disease_Chart.PlotArea.Series[0].TooltipsAppearance.ClientTemplate = "#= dataItem.CohortName#" + ",</br> Cost: $" + "#= dataItem.TotalCost#";
        

            if (usertype_fourth == "aco")
            {
                grd_forth_aco.DataSource = table1;
                //  grd_forth_aco.DataBind();
                Div_fourth_aco.Visible = true;
                Div_fourth_group.Visible = false;
                div_fourth_participant.Visible = false;
            }
            else if (usertype_fourth == "group")
            {
                grd_fourth_group.DataSource = table1;
                grd_fourth_group.DataBind();
                Div_fourth_aco.Visible = false;
                Div_fourth_group.Visible = true;
                div_fourth_participant.Visible = false;
            }
            else if (usertype_fourth == "participant")
            {
                grd_fourth_participant.DataSource = table1;
                grd_fourth_participant.DataBind();
                Div_fourth_aco.Visible = false;
                Div_fourth_group.Visible = false;
                div_fourth_participant.Visible = true;
            }
//frogrp


        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

    protected void grd_forth_aco_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
    {
        GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;

        string where = null;
        string CohortName = dataItem.GetDataKeyValue("CohortName").ToString();
        string AcoId = dataItem.GetDataKeyValue("AcoId").ToString();
        where = "where ba.AcoId='" + AcoId + "' and ba.CohortName = '" + CohortName + "'";


        DataTable _dt1 = new DataTable();
        _dt1 = _objFinancialPerformanceDAL.Fetch_All_Patient_Data_fourthChart(where, 1);
        if (_dt1.Rows.Count > 0)
        {
            e.DetailTableView.DataSource = _dt1;

        }

        ScriptManager.RegisterStartupScript(this, typeof(Page), "Testing", "lnk_Costby_Gendeby_Chronic_Disease_showchart();", true);
    }
    protected void grd_fourth_participant_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
    {
        GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;

        string where = null;

        string CohortName = dataItem.GetDataKeyValue("CohortName").ToString();
        string ACOParName = dataItem.GetDataKeyValue("AcoParName").ToString();
        where = " where ba.ACOParName ='" + ACOParName + "' and ba.CohortName = '" + CohortName + "'";



        DataTable _dt1 = new DataTable();
        _dt1 = _objFinancialPerformanceDAL.Fetch_All_Patient_Data_fourthChart(where, 3);
        if (_dt1.Rows.Count > 0)
        {
            e.DetailTableView.DataSource = _dt1;

        }

        ScriptManager.RegisterStartupScript(this, typeof(Page), "Testing", "lnk_Costby_Gendeby_Chronic_Disease_showchart();", true);
    }
    protected void grd_fourth_group_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
    {
        GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;

        string where = null;

        string CohortName = dataItem.GetDataKeyValue("CohortName").ToString();
        string groupname = dataItem.GetDataKeyValue("TIN_LegalBusinessName").ToString();
        where = " where TIN_LegalBusinessName='" + groupname + "' and ba.CohortName = '" + CohortName + "'";


        DataTable _dt1 = new DataTable();
        _dt1 = _objFinancialPerformanceDAL.Fetch_All_Patient_Data_fourthChart(where, 2);
        if (_dt1.Rows.Count > 0)
        {
            e.DetailTableView.DataSource = _dt1;

        }

        ScriptManager.RegisterStartupScript(this, typeof(Page), "Testing", "lnk_Costby_Gendeby_Chronic_Disease_showchart();", true);
    }

    protected void drpgroupname_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        string grpname = drpgroupname.SelectedValue.ToString();
        DataTable _dt = new DataTable();
        _dt = _objFinancialPerformanceDAL.Fetch_All_Participant_Name(grpname);
        if (_dt.Rows.Count > 0)
        {
            drpparticipant.DataSource = _dt;
            drpparticipant.DataValueField = "Name";

            drpparticipant.DataBind();
            drpparticipant.Enabled = true;
            lblerror.Text = null;
        }
        else
        {
            drpparticipant.DataSource = _dt;
            drpparticipant.DataValueField = "Name";
            drpparticipant.DataBind();
            drpparticipant.Enabled = false;
            lblerror.Text = "No Participant Found...";
        }

    }

    public void fill_filter_of_group()
    {
        if (Session["AcoManager"] != null)   // For AcoManager Login  
        {
            string acoid = Session["AcoManager"].ToString();
            fill_filter_group_name(acoid);
        }
        else if (Session["rolename"].ToString() == "ACOADMIN") // For Aco Login 
        {
            string acoid = Session["ACOid"].ToString();
            fill_filter_group_name(acoid);
        }
        else if (Session["rolename"].ToString() == "PHYSICIAN")  // for participents 
        {
            string acoid = Session["ACOParID"].ToString();
         
            participant.Visible = false;
            group.Visible = false;
            div_submit.Visible = false;

        }
        else if (Session["rolename"].ToString() == "ACOPARTICIPANTSGROUP")  // for participents group
        {
            string grpname = Session["group_tinlegalbuisenessname"].ToString();
            fill_filter_participant_name(grpname);
            participant.Visible = true;
            group.Visible = false;
            div_submit.Visible = true;

        }
        else // For Idesigns 
        {
            // When No chenge in Dropdown 


        }
    }

    public void fill_filter_group_name(string acoid)
    {
        DataTable _dt = new DataTable();
        _dt = _objFinancialPerformanceDAL.Fetch_All_group_Name(acoid);

        drpgroupname.DataSource = _dt;
        drpgroupname.DataValueField = "TIN_LegalBusinessName";

        drpgroupname.DataBind();

    }

    public void fill_filter_participant_name(string grpname)
    {
        DataTable _dt = new DataTable();
        _dt = _objFinancialPerformanceDAL.Fetch_All_Participant_Name(grpname);
        if (_dt.Rows.Count > 0)
        {
            drpparticipant.DataSource = _dt;
            drpparticipant.DataValueField = "Name";

            drpparticipant.DataBind();
            drpparticipant.Enabled = true;
            lblerror.Text = null;
        }
    }
    protected void btn_all_Filter_financial_performance_submit_Click(object sender, EventArgs e)
    {
        string usertype = null;
        string WhereCondtn = null;
        string WhereCondtn_par = null;
        string whereForPopup = null;

        WhereCondtn = drpgroupname.SelectedValue.ToString();
        if (!string.IsNullOrEmpty(WhereCondtn))
            usertype = "group";


        if (drpparticipant.Enabled == true)
        {

            WhereCondtn_par = drpparticipant.SelectedValue.ToString();
            if (!string.IsNullOrEmpty(WhereCondtn_par))
            {
                usertype = "participant";
                WhereCondtn = WhereCondtn_par;
            }
        }
        string count_check = hdn_all_Filter_financial_performance_count.Value.ToString();
        if (!string.IsNullOrEmpty(usertype))
        {
            switch (count_check)
            {
              
                case "fourth":
                    {
                        fill_Costby_Genderby_Chronic_Disease_Aco(usertype, WhereCondtn, whereForPopup);
                        break;
                    }
            }
        }
        drpgroupname.ClearSelection();
        drpparticipant.ClearSelection();

        drpparticipant.Enabled = false;
        if (Session["rolename"].ToString() == "ACOPARTICIPANTSGROUP")
        {
            drpparticipant.Enabled = true;
        }
        ScriptManager.RegisterStartupScript(this, typeof(Page), "Testing", "closewindow_filter();", true);

    }
  
    protected void btnexporttoexcel_Click(object sender, EventArgs e)
    {
        if (Div_fourth_aco.Visible == true)
        {
            exceltoexport(grd_forth_aco);
        }
        else if (Div_fourth_group.Visible == true)
        {
            exceltoexport(grd_fourth_group);
        }
        else
        {
            exceltoexport(grd_fourth_participant);
        }

    }

    public void exceltoexport(RadGrid gridname)
    {
        gridname.ExportSettings.ExportOnlyData = true;
        gridname.ExportSettings.IgnorePaging = true;
        gridname.ExportSettings.OpenInNewWindow = true;
        gridname.ExportSettings.FileName = "fileName";
        gridname.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
        gridname.ExportSettings.HideStructureColumns = true;
        gridname.MasterTableView.HierarchyDefaultExpanded = true;
        gridname.MasterTableView.DetailTables[0].HierarchyDefaultExpanded = true;
        gridname.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;
        gridname.MasterTableView.DetailTables[0].HierarchyLoadMode = GridChildLoadMode.Client;
        gridname.MasterTableView.ExportToExcel();
    }
}

.aspx code

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="radgridchartdemo.aspx.cs" Inherits="radgridchartdemo" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <asp:UpdatePanel runat="server">
        <ContentTemplate>

        
    <div>
        <asp:HiddenField runat="server" ID="hdnfield_firstchartclick" />
          <asp:HiddenField runat="server" ID="hdn_all_Filter_financial_performance_count" />
        <div id="controls">
            <asp:Button runat="server" ID="lnk_paientpop_showdata_first" Text="Show Data" Style="display: block; font-size: 16px; margin-top: -3px; text-decoration: none; color: black; margin-left: 10px; float: right; margin-left: 0px; background: none; border: none; font-family: Times New Roman" OnClientClick="showdata();return false;" />
              <asp:Button runat="server" ID="Button1" Text="Show chart" Style="display: block; font-size: 16px; margin-top: -3px; text-decoration: none; color: black; margin-left: 10px; float: right; margin-left: 0px; background: none; border: none; font-family: Times New Roman" OnClientClick="showchart();return false;" />
           <asp:LinkButton ID="lnk_Costby_Gendeby_Chronic_Disease_cohort_1" runat="server" ToolTip="Filter" Style="color: black; float: right; margin-top: -3px; margin-left: 10px;" OnClientClick="return fourth_financial_performance_myfiles();">Apply Filter</i></asp:LinkButton>
            <asp:Button Text="Export-excel" runat="server" OnClick="btnexporttoexcel_Click" ID="btnexporttoexcel" />
        </div>
        <div id="div_chart" runat="server" >

         
                    <div id="Div_Costby_Gendeby_Chronic_Disease_Chart" runat="server" visible="true" style="display: block">
                        <div runat="server" id="Div_Costby_Gendeby_Chronic_Disease_Chart1" style="width: 100%" visible="true">
                            <telerik:RadHtmlChart runat="server" ID="Costby_Gendeby_Chronic_Disease_Chart"
                                Height="225" Transitions="true" Style="margin-top: 15px"
                                Skin="Silk">
                                <Appearance>
                                    <FillStyle BackgroundColor="White"></FillStyle>
                                </Appearance>
                                <ChartTitle>
                                    <%--<Appearance Align="Center" BackgroundColor="White" Position="Top">
                                                     </Appearance>--%>
                                </ChartTitle>
                                <Legend>
                                    <Appearance BackgroundColor="White" Position="Right" Visible="false">
                                    </Appearance>
                                </Legend>
                                <PlotArea>
                                    <Appearance>
                                        <%--<FillStyle BackgroundColor="White"></FillStyle>--%>
                                    </Appearance>
                                    <Series>
                                        <telerik:PieSeries Name="Gendr1" StartAngle="120">
                                            <LabelsAppearance DataFormatString="{0:C}">
                                            </LabelsAppearance>
                                            <TooltipsAppearance Color="White" DataFormatString="${0}"></TooltipsAppearance>
                                            <SeriesItems>
                                                <%--  <telerik:PieSeriesItem Exploded="true"></telerik:PieSeriesItem>--%>
                                            </SeriesItems>
                                        </telerik:PieSeries>
                                    </Series>
                                </PlotArea>
                            </telerik:RadHtmlChart>
                        </div>

                    </div>
             
        </div>

        <div id="div_grid" runat="server" style="display:none">

            <div id="Div_fourth_aco" runat="server" visible="true">
                <telerik:RadGrid ID="grd_forth_aco" runat="server" Width="99.5%" ShowStatusBar="true" AutoGenerateColumns="false"
                    AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="false" Skin="Silk"
                    OnDetailTableDataBind="grd_forth_aco_DetailTableDataBind">
                    <PagerStyle Mode="Slider"></PagerStyle>
                    <GroupingSettings CaseSensitive="false" />
                    <MasterTableView Width="100%" DataKeyNames="CohortName,AcoId" AllowMultiColumnSorting="True" PageSize="10">
                        <DetailTables>
                            <telerik:GridTableView Name="" Width="100%" AllowFilteringByColumn="true" PageSize="10" AllowPaging="true">
                                <Columns>

                                    <telerik:GridBoundColumn SortExpression="Benehicno" HeaderText="Hic No." HeaderButtonType="TextButton"
                                        DataField="Benehicno">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="BeneName" HeaderText="Patient Name" HeaderButtonType="TextButton"
                                        DataField="BeneName">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="State" HeaderText="State" HeaderButtonType="TextButton"
                                        DataField="State">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="County" HeaderText="County" HeaderButtonType="TextButton"
                                        DataField="County">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="TotalCost" HeaderText="Total Cost" HeaderButtonType="TextButton" DataFormatString=" {0:C} "
                                        DataField="TotalCost">
                                    </telerik:GridBoundColumn>

                                </Columns>
                            </telerik:GridTableView>
                        </DetailTables>
                        <Columns>
                            <telerik:GridBoundColumn SortExpression="AcoId" HeaderText="ACoId" HeaderButtonType="TextButton"
                                DataField="AcoId">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="CohortName" HeaderText="Cohort Name" HeaderButtonType="TextButton"
                                DataField="CohortName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="TotalCost" HeaderText="Total Cost" HeaderButtonType="TextButton" DataFormatString=" {0:C} "
                                DataField="TotalCost">
                            </telerik:GridBoundColumn>

                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
            </div>


            <asp:Panel ID="Div_fourth_group" runat="server" Style="display: block" Visible="false">
                <telerik:RadGrid ID="grd_fourth_group" runat="server" Width="99.5%" ShowStatusBar="true" AutoGenerateColumns="false"
                    AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="false" Skin="Silk"
                    OnDetailTableDataBind="grd_fourth_group_DetailTableDataBind"
                    Visible="true">
                    <PagerStyle Mode="Slider"></PagerStyle>
                    <GroupingSettings CaseSensitive="false" />
                    <MasterTableView Width="100%" DataKeyNames="CohortName,TIN_LegalBusinessName" AllowMultiColumnSorting="True" PageSize="10">
                        <DetailTables>
                            <telerik:GridTableView Name="" Width="100%" AllowFilteringByColumn="true" PageSize="10" AllowPaging="true">
                                <Columns>

                                    <telerik:GridBoundColumn SortExpression="Benehicno" HeaderText="Hic No." HeaderButtonType="TextButton"
                                        DataField="Benehicno">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="BeneName" HeaderText="Patient Name" HeaderButtonType="TextButton"
                                        DataField="BeneName">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="State" HeaderText="State" HeaderButtonType="TextButton"
                                        DataField="State">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="County" HeaderText="County" HeaderButtonType="TextButton"
                                        DataField="County">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="TotalCost" HeaderText="Total Cost" HeaderButtonType="TextButton" DataFormatString=" {0:C} "
                                        DataField="TotalCost">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </telerik:GridTableView>
                        </DetailTables>
                        <Columns>

                            <telerik:GridBoundColumn SortExpression="TIN_LegalBusinessName" HeaderText="Group Name" HeaderButtonType="TextButton"
                                DataField="TIN_LegalBusinessName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="CohortName" HeaderText="Cohort Name" HeaderButtonType="TextButton"
                                DataField="CohortName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="TotalCost" HeaderText="Total Cost" HeaderButtonType="TextButton" DataFormatString=" {0:C} "
                                DataField="TotalCost">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
            </asp:Panel>

            <asp:Panel ID="div_fourth_participant" runat="server" Style="display: block" Visible="false">
                <telerik:RadGrid ID="grd_fourth_participant" runat="server" Width="99.5%" ShowStatusBar="true" AutoGenerateColumns="false"
                    AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="false" Skin="Silk"
                    OnDetailTableDataBind="grd_fourth_participant_DetailTableDataBind" 
                    Visible="true">
                    <PagerStyle Mode="Slider"></PagerStyle>
                    <GroupingSettings CaseSensitive="false" />
                    <MasterTableView Width="100%" DataKeyNames="CohortName,AcoParName" AllowMultiColumnSorting="True" PageSize="10">
                        <DetailTables>
                            <telerik:GridTableView Name="" Width="99.5%" AllowFilteringByColumn="true" PageSize="10" AllowPaging="true">
                                <Columns>

                                    <telerik:GridBoundColumn SortExpression="Benehicno" HeaderText="Hic No." HeaderButtonType="TextButton"
                                        DataField="Benehicno">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="BeneName" HeaderText="Patient Name" HeaderButtonType="TextButton"
                                        DataField="BeneName">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="State" HeaderText="State" HeaderButtonType="TextButton"
                                        DataField="State">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="County" HeaderText="County" HeaderButtonType="TextButton"
                                        DataField="County">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="TotalCost" HeaderText="Total Cost" HeaderButtonType="TextButton" DataFormatString=" {0:C} "
                                        DataField="TotalCost">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </telerik:GridTableView>
                        </DetailTables>
                        <Columns>
                            <telerik:GridBoundColumn SortExpression="AcoParname" HeaderText="Physician Name" HeaderButtonType="TextButton"
                                DataField="AcoParname">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="CohortName" HeaderText="Cohort Name" HeaderButtonType="TextButton"
                                DataField="CohortName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="TotalCost" HeaderText="Total Cost" HeaderButtonType="TextButton" DataFormatString=" {0:C} "
                                DataField="TotalCost">
                            </telerik:GridBoundColumn>

                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
            </asp:Panel>

        </div>
    </div>
    </ContentTemplate>
    </asp:UpdatePanel>
       <div>


        <telerik:RadWindow ID="RadWindow1" runat="server" Modal="true" Title="Filter" Skin="Metro" Behaviors="Close,Maximize,Minimize" AutoSize="false" OnClientClose="windowOnClientClose_filter">
            <ContentTemplate>
                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel6" runat="server" Skin="Vista">
                </telerik:RadAjaxLoadingPanel>
                <telerik:RadAjaxPanel ID="RadAjaxPanel6" runat="server" LoadingPanelID="RadAjaxLoadingPanel6" Skin="Vista">

                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <asp:Panel ID="Panel1" runat="server" Style="width: 100%">
                                <div>
                                    <div>
                                        <div class="tabbable custom-tab">
                                            <ul class="nav nav-tabs">
                                                <li id="li_first" class="active" data-toggle="tab"><a href="#Div1" data-toggle="tab" onclick="return tabclass_1();">Groups</a></li>
                                                <li id="li_data"><a href="#Div2" data-toggle="tab"></a></li>

                                            </ul>
                                            <div class="tab-content">
                                                <div class="tab-pane active" id="Div1" style="Overflow: Auto; min-height: 178px">
                                                    <div>
                                                        <div id="group" runat="server" style="float: left; padding-left: 10px">
                                                            <asp:Label ID="Label1" runat="server" Text="Group Name : "></asp:Label>
                                                            <telerik:RadComboBox ID="drpgroupname" runat="server" Width="180" Height="140"
                                                                EmptyMessage="Type an Group Name..." DataTextField="TIN_LegalBusinessName"
                                                                AllowCustomText="true" Filter="Contains" Skin="Silk" OnSelectedIndexChanged="drpgroupname_SelectedIndexChanged" AutoPostBack="true">
                                                            </telerik:RadComboBox>
                                                        </div>
                                                        <div id="participant" runat="server" style="float: left; padding-left: 10px">
                                                            <asp:Label ID="Label2" runat="server" Text="Participant Name : "></asp:Label>
                                                            <telerik:RadComboBox ID="drpparticipant" runat="server" Width="180" Height="140"
                                                                EmptyMessage="Type an Participant Name..." DataTextField="Name"
                                                                AllowCustomText="true" Filter="Contains" Skin="Silk" Enabled="false">
                                                            </telerik:RadComboBox>
                                                        </div>
                                                        <div style="float: left; padding-left: 10px" id="div_submit" runat="server">
                                                            <asp:Button runat="server" ID="btn_all_Filter_financial_performance_submit" Text="Submit" OnClick="btn_all_Filter_financial_performance_submit_Click" CssClass="btn btn-primary" />
                                                        </div>
                                                        <div style="padding-left: 10px; float: left">
                                                            <asp:Label ID="lblerror" runat="server" Style="color: red; font-size: 16px"></asp:Label>
                                                        </div>

                                                    </div>

                                                </div>
                                                <div class="tab-pane" id="Div2">
                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </asp:Panel>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </telerik:RadAjaxPanel>
            </ContentTemplate>
        </telerik:RadWindow>

    

        <asp:HiddenField ID="wndPercentageValue" runat="server" />

        <script type="text/javascript">
            var TO_abc;
            var oWnd_abc;
            function pageLoad() {
                //populate the global variable that holds a reference to the RadWindow

            }

            function showWindowInPercentage(value) {
                oWnd_abc = $find("<%=RadWindow1.ClientID %>");

                //attach to the window.resize event to resize the RadWindow when the browser changes size
                $telerik.$(window).resize(function () {
                    clearTimeout(TO_abc);

                    TO_abc = setTimeout(sizeWindowInPercentage, 100);
                });
                $telerik.$("#wndPercentageValue").attr("value", value);
                oWnd_abc.show();
                sizeWindowInPercentage();

            }

            function sizeWindowInPercentage() {
                //check first if the RadWindow is shown, if it is not we cannot resize it
                if (oWnd_abc.isVisible()) {
                    //obtain the necessary values - percent and viewport size
                    var value = 80;
                    var browserWidth = $telerik.$(window).width();
                    var browserHeight = $telerik.$(window).height();

                    //resize the RadWindow
                    oWnd_abc.setSize(Math.ceil(browserWidth * value / 100), 310);
                    value = 0;
                    //optionally you may also center the RadWindow
                    //otherwise it will stay where the original calculation for its top left corner leaves it
                    oWnd_abc.center();
                }
            }

            function closewindow_filter() {
                var window = $find('<%=RadWindow1.ClientID %>');
                window.close();
                return false;
            }
            function windowOnClientClose_filter(sender, args) {
                var comboDeactivateReasonTruck = $find("<%= drpgroupname.ClientID %>");
                comboDeactivateReasonTruck.clearSelection();
                comboDeactivateReasonTruck.commitChanges();
                var comboDeactivateReasonTruck = $find("<%= drpparticipant.ClientID %>");
                comboDeactivateReasonTruck.clearSelection();
                comboDeactivateReasonTruck.commitChanges();
            }

        </script>
    </div>



    <script type="text/javascript">
        function showdata() {

            document.getElementById("ContentPlaceHolder1_div_chart").style.display = "none";
            document.getElementById("ContentPlaceHolder1_div_grid").style.display = "block";

           
        }
        function showchart() {

            document.getElementById("ContentPlaceHolder1_div_chart").style.display = "block";
            document.getElementById("ContentPlaceHolder1_div_grid").style.display = "none";


        }
        function fourth_financial_performance_myfiles() {

            var x = document.getElementById('<%= hdn_all_Filter_financial_performance_count.ClientID %>');
           x.value = 'fourth';
           showWindowInPercentage(80);
           return false;

       }
    </script>
</asp:Content>

0
SANJAY
Top achievements
Rank 1
answered on 23 Jun 2014, 09:46 AM
Ashutosh

Donot do this
            grd_firstchart_aco.DataSource = table1;
            grd_firstchart_aco.DataBind();

me.session(gridrs) = table1

Make the Grid visibile / Invisible

Call grd_firstchart_aco_NeedDatasource as spoken

In grd_third_aco_DetailTableDataBind
Also call if dv.value = 1 exit sub
'You donot need to call this if grid is invisible


then all the button code as discussed

my suggestion is make a duplicate page and check it should work

after calling
grid.datasource = rs
donot call grid.bind (It is called automatically)


In need datasource

if dv.value = 1 then exit sub
dim r as new data.dataset
r = ctype(me.session(gridrs), data.dataset)
grid.datasource = r

0
Asutosh
Top achievements
Rank 1
answered on 23 Jun 2014, 11:47 AM
hi sanjay
thanks a lot for reply
its work in my case
now the problem is that my hierarchy grid has pagging and its size is 10 so when i export it as excel only 10 rows is exported
i used below code to export as excel
thanks
  gridname.ExportSettings.FileName = "filename";
            gridname.ExportSettings.IgnorePaging = true;
            gridname.ExportSettings.ExportOnlyData = true;
            gridname.ExportSettings.OpenInNewWindow = true;
            gridname.MasterTableView.UseAllDataFields = true;
            gridname.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;

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

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

            gridname.MasterTableView.ExportToExcel();
0
Asutosh
Top achievements
Rank 1
answered on 24 Jun 2014, 03:50 AM
can anybody please reply asap. we have deadline for our project.
0
SANJAY
Top achievements
Rank 1
answered on 24 Jun 2014, 05:41 AM
check this link

http://www.telerik.com/forums/how-to-export-data-of-all-pages-when-using-radgrid
0
Asutosh
Top achievements
Rank 1
answered on 24 Jun 2014, 05:49 AM
hi
i am following that but still same problem arise in my case
0
SANJAY
Top achievements
Rank 1
answered on 24 Jun 2014, 05:55 AM
Hi Aushotosh

Just to be doubly sure

1) You are binding to grid before exporting with complete recordset (All records) with grid.allowPaging = false. This will show the grid with all your records and export with all records

2) The grid to best of my understanding only exports the records which are supposed to be visible on that page

3) After the export change the value of Allow Paging to true. When you change that to true it will call need datasource.


Regards

Sanjay
0
SANJAY
Top achievements
Rank 1
answered on 24 Jun 2014, 05:58 AM
Probably the problem is that you have called

allowpaging to true but you have not rebound your grid again with all the data and have not called rebind

Please try that

Regards


0
Asutosh
Top achievements
Rank 1
answered on 24 Jun 2014, 07:32 AM
i have done this but still same problem arise
 gridname.AllowPaging = false;
        gridname.Rebind();
      
        gridname.ExportSettings.ExportOnlyData = true;
        gridname.ExportSettings.IgnorePaging = true;
        gridname.ExportSettings.OpenInNewWindow = true;
        gridname.ExportSettings.FileName = "fileName";
        gridname.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
        gridname.ExportSettings.HideStructureColumns = true;
        gridname.MasterTableView.HierarchyDefaultExpanded = true;
        gridname.MasterTableView.DetailTables[0].HierarchyDefaultExpanded = true;
        gridname.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;
        gridname.MasterTableView.DetailTables[0].HierarchyLoadMode = GridChildLoadMode.Client;
        gridname.MasterTableView.ExportToExcel();
        gridname.AllowPaging = true;
0
SANJAY
Top achievements
Rank 1
answered on 24 Jun 2014, 08:12 AM
Ashutosh

Technically
Kindly check in debug mode if the code goes to need datasource after you call rebind

in need datasource ensure that all records are passed to grid

After if comes back from need datasource the code on export should be called

please let me know if the needdatasouce is called before the export function call

0
Asutosh
Top achievements
Rank 1
answered on 24 Jun 2014, 08:36 AM
yaa
i have check that
need datasource is call before ExportToExcel

0
Asutosh
Top achievements
Rank 1
answered on 24 Jun 2014, 08:37 AM
if i set allow paging false in my grid code in .aspx file then its works fine
but if i set pagging then it only export show data
0
Asutosh
Top achievements
Rank 1
answered on 24 Jun 2014, 09:01 AM
hi kostdian 
can you give me sample code to export heirarchy  grid as excel with paging
means i have paging in my hierarchy grid and page size is 10
when i export it as excel it export only 10 row which is visible
help me out of this
0
SANJAY
Top achievements
Rank 1
answered on 24 Jun 2014, 09:02 AM
Ashutosh

In code file set allow paging to false

When you show the grid and you are not exporting change value of allow paging to true

again before exporting change value to false

Turnaround

If the above doesnot work. Put a new grid which is used only for exporting. Keep the grid hidden and use this grid for the purpose of exporting only. if you do this then add another hiddenfield keep the value of this field = 0 in need datasource exit sub if value = 0 when you have to export first change value to 1 then call rebind and then export

0
Asutosh
Top achievements
Rank 1
answered on 24 Jun 2014, 09:15 AM
is this possible in rad grid to export hierarchy grid n excel?
because i have reefer admin demo in that also export only show data not paging data
0
Asutosh
Top achievements
Rank 1
answered on 24 Jun 2014, 09:52 AM
hi sanjay,

Turnaround

If the above doesnot work. Put a new grid which is used only for exporting. Keep the grid hidden and use this grid for the purpose of exporting only. if you do this then add another hiddenfield keep the value of this field = 0 in need datasource exit sub if value = 0 when you have to export first change value to 1 then call rebind and then export 

above has solved my problem and it works well but thing is we have 6 charts on one page and we have 3 grids already for each chart to display level1 group data, level2 group data and level3 group data. so in this solution we need to add another 18 grids per page . and i guess it will create performace issues.

any other workaround ?
0
SANJAY
Top achievements
Rank 1
answered on 24 Jun 2014, 10:17 AM
can you show me the link on webserver to see your page
0
SANJAY
Top achievements
Rank 1
answered on 24 Jun 2014, 10:23 AM
Hi Aushotosh

Then what you can do is create a new page and have 3 grids on the same

The dataset which populates the grid keep in session / ViewState

On export button open the new page in window and load the grids from the session object ( Intention is that it will not consume your resources) then export the grid. to xml in same window

if you are using ony one grid to export then load only one grid

Regards

0
SANJAY
Top achievements
Rank 1
answered on 24 Jun 2014, 12:26 PM
Ashutosh

Are you through

Regards
0
Asutosh
Top achievements
Rank 1
answered on 24 Jun 2014, 12:31 PM
Hi Sanjay,

Hi Aushotosh

Then what you can do is create a new page and have 3 grids on the same

The dataset which populates the grid keep in session / ViewState

On export button open the new page in window and load the grids from the session object ( Intention is that it will not consume your resources) then export the grid. to xml in same window

if you are using ony one grid to export then load only one grid

above didnt worked for me so i ended up putting 18 grids per page. i really appreciate your prompt responses. thank you very much
0
SANJAY
Top achievements
Rank 1
answered on 24 Jun 2014, 12:45 PM
Hi Ashutosh

1) 18 grids should not make the page slow because if you store the recordset in session object then you donot have to recreate it and saves a lot of time

2) Principally I keep a hidden field and populate the grid only if it is to be visible to user ie like when in TABS and if the grid is not visible then donot populate the data

3) My Profile Age 50 years / Qualification MS Surgery / Software by self study

4) If possible for my satisfaction if you can give me link on development server (if not inconvienient)


Regards

0
Asutosh
Top achievements
Rank 1
answered on 25 Jun 2014, 01:20 PM
i am getting a window asking to select yes or no while i try to open excel file which is exported from grid. check attached screenshot. is there any way to remove this ?

and sanjay i cannot send you link directly as it is on local host
0
SANJAY
Top achievements
Rank 1
answered on 26 Jun 2014, 01:08 AM
Hi Ashutosh

The window is from EXCEL Application. This window is because the extension of your file is .xls and new version of office by default uses .xlsx. It may not be possible to remove the window. But I guess you can check with Telerik if it possible to change the format to .xlsx

It is ok about the link

Regards
0
Shahista
Top achievements
Rank 1
answered on 26 Jun 2014, 01:31 PM
Hi Im having an issue on the export to excel. The value is displaying correctly in textbox but not GridBound column, here it gets cut off halfway. My code is shown as below
<telerik:RadGrid ID="GridView4"  runat="server" OnGridExporting="gv_GridExporting" GridLines="None" Width="100%" AutoGenerateColumns="false" ImagesPath="Images/Grid/" AllowSorting="True" ShowGroupPanel="True" ItemStyle-Wrap="false"  OnDataBound="GridView4_DataBound" BorderWidth="0">
<ExportSettings FileName="WorkflowExport" HideStructureColumns="True" ExportOnlyData="true" IgnorePaging="True" OpenInNewWindow="True">
</ExportSettings>
<ClientSettings AllowDragToGroup="True"></ClientSettings>
<MasterTableView Font-Names="Tahoma,Helvetica" Font-Size="11px">
<CommandItemSettings ExportToExcelImageUrl="Images/ExcelIcon.png" ShowExportToExcelButton="true"></CommandItemSettings>
<Columns>
<telerik:GridBoundColumn DataField="CampaignNo" HeaderText="Campaign No" SortExpression="CampaignNo" />
<telerik:GridBoundColumn  DataField="JobNo" HeaderText="Job No" SortExpression="JobNo" />
<telerik:GridBoundColumn  DataField="CampDescription" HeaderText="Camp Description" SortExpression="CampDescription" />
<telerik:GridBoundColumn  DataField="Medium" HeaderText="Medium" SortExpression="Medium" />
<telerik:GridBoundColumn  DataField="Category" HeaderText="Category" SortExpression="Category" />
<telerik:GridBoundColumn ReadOnly="True" DataField="BriefDesc" HeaderText="Brief Desc" SortExpression="BriefDesc" />
<telerik:GridBoundColumn  DataField="Region" HeaderText="Region" SortExpression="Region" />
<telerik:GridBoundColumn DataField="Language" HeaderText="Language" SortExpression="Language" />
<telerik:GridBoundColumn  DataField="Week" HeaderText="Week" SortExpression="Week" />
<telerik:GridBoundColumn  DataField="CurrentCPAStage" HeaderText="Current CPA Stage" SortExpression="CurrentCPAStage" />
<telerik:GridBoundColumn  DataField="CurrentCPADate" HeaderText="Current CPA Date" SortExpression="CurrentCPADate" Display="False" />
<telerik:GridBoundColumn  DataField="ProjectedCPAStage" HeaderText="Projected CPA Stage" SortExpression="ProjectedCPAStage" />
<telerik:GridBoundColumn  DataField="ProjectedCPADate" HeaderText="Projected CPA Date" SortExpression="ProjectedCPADate" Display="False" />
<telerik:GridBoundColumn  DataField="NextCPAStage" HeaderText="Next CPA Stage" SortExpression="NextCPAStage" />
<telerik:GridBoundColumn  DataField="NextCPAStageDate" HeaderText="Next CPA Stage Date" SortExpression="NextCPAStageDate" />
<telerik:GridBoundColumn  DataField="Comments" HeaderText="Comments" MaxLength="5000"  DataType="System.String"  SortExpression="Comments" />
<telerik:GridBoundColumn DataField="MediaList"  HeaderText="Media" SortExpression="MediaList" >
<ItemStyle Width="150px"></ItemStyle>
</telerik:GridBoundColumn>
</Columns>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<EditFormSettings>
<EditColumn InsertImageUrl="Images/Grid/Update.gif" UpdateImageUrl="Images/Grid/Update.gif"
EditImageUrl="Images/Grid/Edit.gif" CancelImageUrl="Images/Grid/Cancel.gif" FilterImageUrl="Images/Grid/Filter.gif"
SortAscImageUrl="Images/Grid/SortAsc.gif" SortDescImageUrl="Images/Grid/SortDesc.gif">
</EditColumn>
</EditFormSettings>
<PagerStyle PrevPageImageUrl="Images/Grid/PagingPrev.gif" NextPageImageUrl="Images/Grid/PagingNext.gif"
FirstPageImageUrl="Images/Grid/PagingFirst.gif" LastPageImageUrl="Images/Grid/PagingLast.gif"></PagerStyle>
<PagerStyle PrevPageImageUrl="Images/Grid/PagingPrev.gif" NextPageImageUrl="Images/Grid/PagingNext.gif"
   FirstPageImageUrl="Images/Grid/PagingFirst.gif" LastPageImageUrl="Images/Grid/PagingLast.gif"></PagerStyle>
</MasterTableView>
                                                                        <PagerStyle FirstPageImageUrl="Images/Grid/PagingFirst.gif"
                                                                            LastPageImageUrl="Images/Grid/PagingLast.gif"
                                                                            NextPageImageUrl="Images/Grid/PagingNext.gif"
                                                                            PrevPageImageUrl="Images/Grid/PagingPrev.gif" />
                                                                    </telerik:RadGrid> 
0
Shinu
Top achievements
Rank 2
answered on 27 Jun 2014, 10:27 AM
Hi Shahista,

I'm not able to replicate such an issue at my end. Can you try increasing the width of that column by using HeaderStyle-Width="..." or try setting TableLayout="Fixed" in MasterTableView and check if the issue is resolved.

Thanks,
Shinu
0
Vaibhav
Top achievements
Rank 1
answered on 08 Sep 2014, 11:48 AM
Hi.
I need  to export only selected rows to excel.
I am able to hide columns before exporting.
I have searched a lot regarding hiding unselected rows/Exporting only selected rows in telerik threads.
In all my search results I found the below line of code. 

​ if (Grid.SelectedItems.Count != 0)
{
foreach (GridDataItem item in Grid.MasterTableView.Items)
{
if (!item.Selected)
item.Visible = false;
}
} My excel format is"BIFF".
Its very urgent.
Please help
0
Shahista
Top achievements
Rank 1
answered on 08 Sep 2014, 01:01 PM
hi

just an idea
why dont you have a hidden grid on your page that you bind with your dataset of all selected rows and then just import that hidden grid?

shahistas@hc.co.za
0
Syan
Top achievements
Rank 1
answered on 13 Feb 2015, 03:12 AM
while i export excel sheet. in Gird only date column but when i exporting this Gird  column exported as data-time column it's any method or property to avoid this datetime column while i exporting 

Thank You 
Regards
Vikas 

0
Ravi
Top achievements
Rank 1
answered on 16 Mar 2016, 06:19 AM

Dear Team,

I am new to Telerik. I have downloaded the trail version and making a demo with GridView. I am able to achieve the grid bind feature, however I am not able to export the data.I am attaching screen grab of ASPX, ASPX.CS, Runtime (output) and Exported view. Let me know the mistake I must be doing.

Regards,
Ravi

0
Kostadin
Telerik team
answered on 21 Mar 2016, 06:15 AM
Hello Ravi,

I examined the provided code and the output and I noticed that you are using Xlsx export format. Note that this export format exports the content of the TemplateColumn without formatting the html content. In other words it is expected to receive the raw html in the Excel cells. What I can suggest you is to use HTML export format in case you want to display the formatted html in the Excel cells or remove the template column values when exporting to Xlsx. 

Regards,
Kostadin
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Ravi
Top achievements
Rank 1
answered on 21 Mar 2016, 10:12 AM

Hello Kostadin,

Thanks for you reply. Per your suggestion I changed the format to HTML. Now its exporting without any raw HTML but it exports everything in column A.... As if I have transpose the data from Columns to Rows.

Regards,
Ravi

0
Kostadin
Telerik team
answered on 24 Mar 2016, 09:05 AM
Hello Ravi,

Could you please send the exported document, the grid declaration and the related code behind in order to investigate the cause for this behavior locally?

Regards,
Kostadin
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Arvind
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Arvind
Top achievements
Rank 1
Daniel
Telerik team
improwise
Top achievements
Rank 1
Iron
Iron
Princy
Top achievements
Rank 2
Asutosh
Top achievements
Rank 1
Kostadin
Telerik team
SANJAY
Top achievements
Rank 1
Shahista
Top achievements
Rank 1
Vaibhav
Top achievements
Rank 1
Syan
Top achievements
Rank 1
Ravi
Top achievements
Rank 1
Share this question
or