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

No alt text for binary image column

3 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
miksh
Top achievements
Rank 1
Iron
miksh asked on 18 May 2012, 06:26 PM
If a field used to display the image alt text is NOT type of string (e.g. int) then the alt text is not generated
E.g.

<telerik:GridBinaryImageColumn
        DataField="MyImage"
        DataAlternateTextField="MyId" DataType="System.Int32"
        DataAlternateTextFormatString="{0}"
        ImageAlign="Middle"
        HeaderText="Image" FooterText="Image"
        HeaderStyle-Width="50"
        AllowFiltering="false" AllowSorting="false"
        Groupable="False"  ResizeMode="Fit" ImageHeight="50px" ImageWidth="50px"
        ReadOnly="True" DefaultImageUrl="../img/noimage.png">
</telerik:GridBinaryImageColumn>


3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Sep 2012, 09:57 AM
Hi,

Please take a look into the following code snippet I tried to give Alternate text as integer for GridBinaryImageColumn.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem ditem = (GridDataItem)e.Item;
        RadBinaryImage image = (RadBinaryImage)ditem["MyImage"].Controls[0];
        if (image.DataValue == null)
        {  
            image.AlternateText = DataBinder.Eval(ditem.DataItem, "MyId").ToString();
        }
    }
}

Thanks,
Shinu.
0
miksh
Top achievements
Rank 1
Iron
answered on 13 Sep 2012, 01:16 PM
Thanks Shinu but my point was that it sounds like a bug in RadGrid.
0
Radoslav
Telerik team
answered on 18 Sep 2012, 07:03 AM
Hi Michael,

Indeed I verified that the described issue exists into the current version of our controls. However our developers are aware and they will start working on the resolution of this issue.

Greetings,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
miksh
Top achievements
Rank 1
Iron
Answers by
Shinu
Top achievements
Rank 2
miksh
Top achievements
Rank 1
Iron
Radoslav
Telerik team
Share this question
or