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

Adding images to row

1 Answer 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
s
Top achievements
Rank 1
s asked on 20 Apr 2011, 08:40 PM
I'm trying to generate images at run time and display them in the header row.  I'm trying to do this programatically in the code behind.  I can only seem to display text in the header row.  Both the number of rows and the number of columns are determined at run time. Is there a way I can insert binary image data directly into the header?

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 25 Apr 2011, 02:07 PM
Hi,

You could use RadBinaryImage in the data rows of the grid, but not in it's header. The control needs to have specified DataValue which determines the source field from which the data will be passed as a byte array.

You will find more information here:
http://www.telerik.com/help/aspnet-ajax/radbinaryimage.html
http://demos.telerik.com/aspnet-ajax/binaryimage/examples/default/defaultcs.aspx

To place an image into the header this approach can be used:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)         
   {
       if (e.Item is GridHeaderItem)
       {
           GridHeaderItem header = (GridHeaderItem)e.Item;
           Image img=new Image();
           img.ID = "Image1";
           img.ImageUrl = "~/Image1.gif";
           header["columnUniqueName"].Controls.Add(img); 
       }
   }

Greetings,
Vasil
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
s
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or