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

RadGridView printing issues

1 Answer 142 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 16 Apr 2012, 12:39 PM
I am using the RadGridView
And I am having few doubts (WPF thing )
1) I am making the Autogenerated columns as True then the data gets populated auomatically. But what is the thing if I have the Property in the binding collection of type BOOLEAN and I want that to be shown as CheckBox, Can this be achieved with Autogenerated columns as True.

2) I am using the printing functionality for the gridview, incase I have a dropdown in the column and how do i get the selected dropdown item from that column and print it.

3) Also how do I print images from a grid view

4) And Finally I want to do some error handling for the data in the RadGridView, I dont find any where in ur site like demo kind for the error handling thing.

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 16 Apr 2012, 02:38 PM
Hello,

As to your questions,

1. If your bound data is Bool, then the auto generated column will be created with CheckBoxes.
2. You could review the online demo for an example on how you could print to a PDF. 
3. In order to print an image, you should add it to the RadDocument. This is how this could be done:

ImageInline imageInline;
    
 using(Stream stream = Application.GetResourceStream(GetResourceUri("telerik-logo.png")).Stream)
           {
               imageInline = newImageInline(stream, newSize(100,35),"png");
           }
    
           this.AddCellDataSpan((TableCell)row.Cells.First.NextSibling,string.Empty, Colors.Transparent, Colors.Black, RadTextAlignment.Center, imageInline);
...
privatevoidAddCellDataSpan(TableCell cell, stringspanData, Color textColor)
        {
            this.AddCellDataSpan(cell, spanData, Colors.Transparent, textColor, Telerik.Windows.Documents.Layout.RadTextAlignment.Left);
        }
   
        privatevoidAddCellDataSpan(TableCell cell, stringspanData, Color cellBackgroundColor, Color textColor, Telerik.Windows.Documents.Layout.RadTextAlignment cellTextAligment, ImageInline image = null)
        {
            var paragraph = newParagraph();
            paragraph.TextAlignment = cellTextAligment;
            cell.Blocks.Add(paragraph);
   
            cell.Background = cellBackgroundColor;
   
            if(!string.IsNullOrEmpty(spanData))
            {
                var span = newSpan();
                span.Text = spanData;
                span.ForeColor = textColor;
                paragraph.Inlines.Add(span);
            }
   
            if(image != null)
            {
                paragraph.Inlines.Add(image);
            }        }

4. You can implement error handling in RadGridView as explained at our online documentation.

I hope that this is helpful.
  

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Rahul
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or