RadGridView printing issues

2 posts, 0 answers
  1. Rahul
    Rahul avatar
    4 posts
    Member since:
    Feb 2012

    Posted 16 Apr 2012 Link to this post

    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.
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 16 Apr 2012 Link to this post

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

Back to Top