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

Setting Icon dynamically in RadGrid Column

1 Answer 500 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gullo
Top achievements
Rank 1
Gullo asked on 04 Jun 2012, 12:47 PM
Hi,

In my Grid i have a Column that Show me a Date. Now i have to implement a logic that checks how many days are left until the date and after I have to set at the ride side from the date the Icon. I have 4 Icons. Can somone tell me an approach to implement this logic?

kind regards

<telerik:GridBoundColumn UniqueName="DueDate" SortExpression="DueDate" DataFormatString="{0:d}"
    HeaderText="<%$Resources:ESTV.A3, FieldDueDate%>" DataField="DueDate" />

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 04 Jun 2012, 05:35 PM
Hello Gullo,

<telerik:GridTemplateColumn DataField="DueDate" SortExpression="DueDate">
                       <ItemTemplate>
                           <asp:Label ID="Label1" runat="server" Text='<%# Eval("DueDate") %>'></asp:Label>
                           <asp:Image ID="Image1" runat="server" />
                       </ItemTemplate>
                   </telerik:GridTemplateColumn>
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
 
            if (e.Item is GridDataItem)
            {
                GridDataItem item = e.Item as GridDataItem;
                Image Image1 = item.FindControl("Image1") as Image;
                Image1.ImageUrl = "your image url";
 
            }
}


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Gullo
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or