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
Set the ExportSettings -> ExportOnlyData property to True to include the controls in the exported file.
-Shinu.
I have Set the ExportOnlyData="true" for RadGrid but it is not Working.
Thanks,
Chary.
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.
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.
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
- 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?
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
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.
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.
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.
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();
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
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.
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();
Why you have mentioned that you can't do the binding in OnNeedDataSource, can you please elaborate your requirement for further help?
Thanks,
Shinu.
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
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.
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 ?
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
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
i have put radgrid in div
if the div is visible false can radgrid onneeddatasource event call?
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
but in my case its not woking
when my div is visible then its work
but when it hide its not working
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
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
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
thats y i cant do that
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
Post the code of aspx page and vb file here and I will make the necessary changes and sent to you
Regards
<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();
}
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>
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
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();
http://www.telerik.com/forums/how-to-export-data-of-all-pages-when-using-radgrid
i am following that but still same problem arise in my case
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
allowpaging to true but you have not rebound your grid again with all the data and have not called rebind
Please try that
Regards
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;
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
i have check that
need datasource is call before ExportToExcel
but if i set pagging then it only export show data
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
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
because i have reefer admin demo in that also export only show data not paging data
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 ?
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
Are you through
Regards
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
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
and sanjay i cannot send you link directly as it is on local host
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
<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>
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
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
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
Thank You
Regards
Vikas
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
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
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
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