I am getting "Null refrence exception" when tries to use ToHtml(); It was working perfectly in the previous versions(2010.1.603.1030) but getting this issue when we upgraded to 2010.2.714.1030
Here content = this.ContactListGrid.ToHtml(); gives null refrence exception but content = this.ContactListGrid.ToHtml(this.ContactListGrid.SelectedItems, true); Works perfectly
i'm using this this.ContactListGrid.ToHtml(); to get all rows from Grid and this.ContactListGrid.ToHtml(this.ContactListGrid.SelectedItems, true); for only selected records ,....and i can't change that..
We upgraded to new version to get rid of CanUserSelect issue.
Can you provide DLL which has solution for CanUserSelect and everything same as 2010.1.603.1030 vesrion ?
Thanks
hemant
10 Answers, 1 is accepted
Could you please send us the solution that exhibits this problem?
Best wishes,Yavor Georgiev
the Telerik team
How about if you try:
grid.Export(stream, new GridViewExportOptions { Format = ExportFormat.Html, Items = grid.Items, ShowColumnHeaders = true });Yavor Georgiev
the Telerik team
Ok...
Sorry for incomplete info..
Actuly we dont want the File "Save As" dialogue...if user used Export to Excel option then we just want to Export the records and open it in Excel file. We Take care that each user has excel installed on their machie as we are using
ActiveXObject(
"Excel.Application").
It very Urgent and Important requirement by users.....
Thanks
Hemant..
So, you want to get the data from the RadGridView, open Excel and make it open the exported file, without the user having to save the file, then open the file from Excel, etc... Right? Wouldn't it be easier to use copy and paste?
Greetings,Yavor Georgiev
the Telerik team
Yes Perfect
It will work like this
Page With Grid will open with Records--> User Right Clicks on Grid and Select option "Export All to Excel" --> All records will be exported to Excel and will open in Excel--> If he/she wants to save then only they can save
Wouldn't it be easier to use copy and paste?
NO :(
Actuly it was like this from many releases and our user dont want to do it using Copy And Paste....
Could you please try to get the HTML string from the RadGridView export via this code:
var options = new GridViewExportOptions{ Format = ExportFormat.Html, Items = grid.Items, ShowColumnHeaders = true};var stream = new System.IO.MemoryStream();grid.Export(stream, options);var htmlString = new System.IO.StreamReader(stream).ReadToEnd();Regards,
Yavor Georgiev
the Telerik team
I got the same Exception even with your code:
NullReferenceException: at Telerik.Windows.Data.TypeExtensions.DefaultValue(Type type)
I using:
RadControls for Silverlight version: 2010.3.1110.1040
Have you a fix for that ?
Please try our just released service pack instead (Q3 2010 SP1).
Regards,Vlad
the Telerik team
Regards
Samuele
