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

Exporting to Excel and Printing

3 Answers 134 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.
Rajnikant Rajwadi
Top achievements
Rank 1
Rajnikant Rajwadi asked on 27 Oct 2009, 10:56 AM
Hello To All,

I write code for export grid data to excel and print.
Its working fine on my local computer. when i upload source code on server its not working at all.

Please help me. What to do ?

Thanks,
Rajnikant

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 27 Oct 2009, 11:34 AM
Hi Rajnikant,

Most probably the application does not have enough rights to save the file on the server. You can try local export/print similar to our latest demos:

http://demos.telerik.com/silverlight/beta/#GridView/Exporting (Save as file directly)
http://demos.telerik.com/silverlight/beta/#GridView/Printing (PrintToHtml() method)

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Sarper
Top achievements
Rank 2
answered on 09 Aug 2012, 10:43 AM
Hello,

I wanted to use your gridview's print feature. but the link you give does not work.
http://demos.telerik.com/silverlight/beta/#GridView/Printing (PrintToHtml() method)

Your new printing link has some problems; it only works for first time. ( PrintAndExportWithRadDcument )
In first time,
Printing page opens and shows me a dialog. If I click cancel, it closes that dialog successfully.
After, the second time; Print button does not work. Does nothing.

Can you help me to find out what is the problem?
Thank you,
Sarper

0
Vlad
Telerik team
answered on 09 Aug 2012, 12:24 PM
Hello Sarper,

 We've fixed this issue immediately and the fix will be part of our next demos upload. In the meantime here is how to fix it at your end:

PrintAndExportWithRadDocumentModel.cs
...............................................................................
public void Print(object parameter)
{
    RadGridView grid = (RadGridView)parameter;

    RadRichTextBox rtb = null;
    string rtBname = "RadRichTextBox1";

    Grid parent = grid.ParentOfType<Grid>();
    if (parent != null)
    {
        if (parent.FindName(rtBname) == null)
        {
            rtb = new RadRichTextBox() { Height = 0 };
            rtb.Name = rtBname;
            parent.Children.Add(rtb);
            rtb.ApplyTemplate();
        }
        else
        {
            rtb = parent.FindName(rtBname) as RadRichTextBox;
        }
    }

    if (rtb != null)
    {
        rtb.Dispatcher.BeginInvoke((Action)(() =>
            {
                rtb.Document = CreateDocument(grid);
            }));

        rtb.Print("MyDocument", Documents.UI.PrintMode.Native);
    }
}

I've added 1000 Telerik points to your account. 

All the best,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Rajnikant Rajwadi
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Sarper
Top achievements
Rank 2
Share this question
or