Hi,
I have a search form , in which user fills information.
Is is not compulsory to fill all the information, so whatever user has filled according to that i show the result in my RadGrid.
My query looks like this.
Dim connection As SqlConnection =
New SqlConnection(ConfigurationManager.ConnectionStrings("InductoServConnectionString").ToString())
connection.Open()
cmd = New SqlCommand("select * from tblServiceReports where " + Condition, connection)
myReader = cmd.ExecuteReader()
gdCstRecovery.DataSource = myReader
Here "condition" is a variable which contains parameters.
When radgrid shows the result, i try to export it using provided button Export to Excel in ExcelML format.
But excel is coming blank. No column or any data is present.
Please help. It is quite urgent.
I have a search form , in which user fills information.
Is is not compulsory to fill all the information, so whatever user has filled according to that i show the result in my RadGrid.
My query looks like this.
Dim connection As SqlConnection =
New SqlConnection(ConfigurationManager.ConnectionStrings("InductoServConnectionString").ToString())
connection.Open()
cmd = New SqlCommand("select * from tblServiceReports where " + Condition, connection)
myReader = cmd.ExecuteReader()
gdCstRecovery.DataSource = myReader
Here "condition" is a variable which contains parameters.
When radgrid shows the result, i try to export it using provided button Export to Excel in ExcelML format.
But excel is coming blank. No column or any data is present.
Please help. It is quite urgent.
8 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 25 Sep 2013, 01:13 PM
Hi ,
Please try to enable UseAllDataFields property in MasterTableView:
ASPX:
If this doesn't help,please provide your full code snippet.
Thanks,
Princy
Please try to enable UseAllDataFields property in MasterTableView:
ASPX:
<MasterTableView UseAllDataFields="true" ... >If this doesn't help,please provide your full code snippet.
Thanks,
Princy
0
Kavita
Top achievements
Rank 1
answered on 26 Sep 2013, 08:50 AM
I am showing footer in grid for one column to show its total.
When i use
When i use
<MasterTableView UseAllDataFields="true" ... > , my total footer does not get displayed in Excel.0
Princy
Top achievements
Rank 2
answered on 26 Sep 2013, 12:19 PM
Hi Kavitha,
Please try the sample code snippet to export footer to excel.
ASPX:
C#:
Thanks,
Princy
Please try the sample code snippet to export footer to excel.
ASPX:
<asp:Button ID="Button1" runat="server" Text="Export" OnClick="Button1_Click" /><telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" Width="600px" OnExcelMLExportRowCreated="RadGrid1_ExcelMLExportRowCreated"> <ExportSettings ExportOnlyData="true" Excel-Format="ExcelML" /> <MasterTableView AutoGenerateColumns="false" ShowFooter="true"> <Columns> <telerik:GridBoundColumn Aggregate="Count" DataField="ProductName" FooterAggregateFormatString="Total products: {0}" /> <telerik:GridBoundColumn Aggregate="Sum" DataField="Price" FooterAggregateFormatString="Total: {0}" /> <telerik:GridBoundColumn DataField="Manufacturer" /> </Columns> </MasterTableView></telerik:RadGrid>C#:
protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) { DataTable table = new DataTable(); table.Columns.Add("ProductName"); table.Columns.Add("Price", typeof(double)); table.Columns.Add("Manufacturer"); table.Rows.Add("Futo maki", 12.44, "Osaka Nihonbashi"); table.Rows.Add("Musaka", 10.61, "Sofiiski gozbi"); table.Rows.Add("Cheesezer", 9.50, "Burger mafia"); RadGrid1.DataSource = table; } protected void RadGrid1_ExcelMLExportRowCreated(object source, GridExportExcelMLRowCreatedArgs e) { if (e.Worksheet.Table.Rows.Count == RadGrid1.Items.Count + 1) { RowElement row = new RowElement(); GridFooterItem footer = (source as RadGrid).MasterTableView.GetItems(GridItemType.Footer)[0] as GridFooterItem; foreach (GridColumn column in (source as RadGrid).MasterTableView.Columns) { CellElement cell = new CellElement(); string cellText = footer[column.UniqueName].Text; cell.Data.DataItem = cellText == " " ? "" : cellText; row.Cells.Add(cell); } e.Worksheet.Table.Rows.Add(row); } } protected void Button1_Click(object sender, EventArgs e) { RadGrid1.MasterTableView.ExportToExcel(); }Thanks,
Princy
0
0
Hello Sambhaji,
Could you please let me know whether you are using a ExcelML export format in your case. Also I would appreciate if you can provide your code declaration and the related code behind in order to investigate it further.
Regards,
Kostadin
Telerik
Could you please let me know whether you are using a ExcelML export format in your case. Also I would appreciate if you can provide your code declaration and the related code behind in order to investigate it further.
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
Tom
Top achievements
Rank 1
answered on 20 Nov 2015, 08:11 PM
Was this issue ever solved? I'm having the same problem.
0
Hi,
Could you please provide a small runnable sample since the issue could not be replicated with the provided code in the Princy's reply?
Regards,
Kostadin
Telerik
Could you please provide a small runnable sample since the issue could not be replicated with the provided code in the Princy's reply?
Regards,
Kostadin
Telerik
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 Feedback Portal
and vote to affect the priority of the items
0
Tom
Top achievements
Rank 1
answered on 25 Nov 2015, 02:50 PM
nevermind. The solutions was to enable viewstate. Thanks.