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

RadGrid Group Image

3 Answers 122 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 25 Jul 2008, 10:01 AM
Hi,

Is it possible to put an image in the group header of a radgrid?
so the format

<Image> " Some Text " <count>

Cheers

Paul

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 25 Jul 2008, 10:43 AM
Hi Paul,

You can try the following code snippet to add an image in the GridGroupHeader.

CS:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridGroupHeaderItem) 
        { 
            GridGroupHeaderItem header = (GridGroupHeaderItem)e.Item; 
            Image image = new Image(); 
            image.ID = "Image1"
            image.ImageUrl = "~/Image1.gif"
            header.DataCell.Controls.Add(image); 
 
        } 
    } 


You can also refer the following help article to get details about customizing the GridGroupHeader.
Customizing GridGroupHeaderItem

Thanks
Shinu.
0
Henrique Duarte
Top achievements
Rank 1
Veteran
answered on 06 Aug 2008, 02:46 PM
Hi,

How can I add a image to group header keeping the group header text?

Regards,

Henrique
0
Nikolay Rusev
Telerik team
answered on 07 Aug 2008, 05:28 AM
Hello Henrique Duarte,

You can try the code shown below
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
{  
    if (e.Item is GridGroupHeaderItem)  
    {  
        GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item;  
        Image myImage = new Image();  
        myImage.ImageUrl = "some image url";  
        myImage.AlternateText = item.DataCell.Text;  
        myImage.ToolTip = item.DataCell.Text;  
        item.DataCell.Controls.Add(myImage);  
        item.DataCell.Controls.Add(new LiteralControl(item.DataCell.Text));  
    }  
 


Sincerely yours,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Henrique Duarte
Top achievements
Rank 1
Veteran
Nikolay Rusev
Telerik team
Share this question
or