Question on the NWindLayout demo
dxdemo://Win/XtraGrid/MainDemo/NWindLayout
How to place an image in the field?
Do I need to store the picture in the database?
or
The picture is stored on a local disk, and the database stores a link to the picture and the "Photo" field displays the photo according to the link?
As far as I understand, you have a column in your database, whose data are strings representing paths to images. And you are assigning PictureEdit as an in-place editor for the column. If so, the approach with using an unbound column is recommended since the PictureEdit editor does not provide the capability to show an image by setting a string path as an editor's value:
void gridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e) {
GridView view = sender as GridView;
if(e.Column.FieldName == "Image" && e.IsGetData) {
string fileName = view.GetRowCellValue(view.GetRowHandle(e.ListSourceRowIndex), "ImagePath");
e.Value = /* get image from cache by filename or load image from file and add to cache */
}
}
Take a look at the How to display external images in Grid if its data source contains links to the images example to see this approach in action.