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

[Solved] ToHtml() in Newer Version's of Grid

10 Answers 129 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
hemant
Top achievements
Rank 1
hemant asked on 22 Jul 2010, 02:26 PM
Hi ,
  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

Sort by
0
Yavor Georgiev
Telerik team
answered on 22 Jul 2010, 02:30 PM
Hi hemant,

 Could you please send us the solution that exhibits this problem?

Best wishes,
Yavor Georgiev
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
hemant
Top achievements
Rank 1
answered on 22 Jul 2010, 02:33 PM
No....Actulyy its Bigger Enterprise Application ...
0
Yavor Georgiev
Telerik team
answered on 22 Jul 2010, 02:39 PM
Hi hemant,

 How about if you try:

grid.Export(stream, new GridViewExportOptions { Format = ExportFormat.Html, Items = grid.Items, ShowColumnHeaders = true });

Sincerely yours,
Yavor Georgiev
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
hemant
Top achievements
Rank 1
answered on 22 Jul 2010, 02:44 PM

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..

 

0
Yavor Georgiev
Telerik team
answered on 22 Jul 2010, 02:47 PM
Hello 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
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
hemant
Top achievements
Rank 1
answered on 22 Jul 2010, 02:52 PM
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?
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....
0
Yavor Georgiev
Telerik team
answered on 22 Jul 2010, 03:57 PM
Hi hemant,

 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();

Please provide a sample application if this snippet throws an exception.

Regards,
Yavor Georgiev
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
Samuele
Top achievements
Rank 2
answered on 19 Jan 2011, 06:24 PM
Hello all,

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 ?
0
Vlad
Telerik team
answered on 20 Jan 2011, 08:14 AM
Hi,

 Please try our just released service pack instead (Q3 2010 SP1).

Regards,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
System Engineer
Top achievements
Rank 1
answered on 20 Jan 2011, 09:48 AM
Thanks, with the new Version its working fine ;-)

Regards
Samuele
Tags
GridView
Asked by
hemant
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
hemant
Top achievements
Rank 1
Samuele
Top achievements
Rank 2
Vlad
Telerik team
System Engineer
Top achievements
Rank 1
Share this question
or