Can someone provide an example of how to display an Image field in a WebDataGrid from a SQL Server table?
Hello Angela,
We don't have sample demonstrating this exact scenario but I think the following resources will help you accomplish what you need:
How to create a custom templated column:
https://www.infragistics.com/help/aspnet/webdatagrid-column-templates
https://www.infragistics.com/samples/aspnet/data-grid/using-cell-and-column-templates
How to create a column with a checkbox. This is similar to your case but instead of checkbox you'll have to add an image:
https://www.infragistics.com/samples/aspnet/data-grid/checkbox-column
How to bind WebDataGrid to SqlDataSource:
https://www.infragistics.com/samples/aspnet/data-grid/binding-to-sqldatasource
All samples we have for WebDataGrid:
https://www.infragistics.com/samples/aspnet/data-grid/overview
best regards,
Bobby
Thank you for the links. I am able to get this far, but what is displayed is a box with an "X". The datatype of the field in SQL Server is "Image".
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="350px" Width="400px" AutoGenerateColumns="False" DataSourceID="ds_Current_User">
<Columns>
<ig:TemplateDataField Key="Employee_Photo">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl='<%# DataBinder.Eval(CType(Container, Infragistics.Web.UI.TemplateContainer).DataItem, "Employee_Photo")%>' />
</ItemTemplate>
<Header Text="Employee_Photo">
</Header>
</ig:TemplateDataField>
</Columns>
</ig:WebDataGrid>
this is what is returned if I make the field a TemplateDataField:
this is what is returned if I leave the field as a BoundDataField: