jaykhatri
asked on
RepositoryItemPictureEdit in DevExpress LayoutView - Assigning Image from url
Hi, (Question Value 500)
I have been struggling from past 5 hours to populate the image from the database, where database have a url (text) from where image has to be loaded.
I am using Devexpress Winforms 9, and doing this in Layoutview repositoryitempictureedit.
Non of the given event is working so that I may intercept the loading and pass the image based on path given in database.
Please help me out if someone here using Devexpress controls.
Jay Khatri
I have been struggling from past 5 hours to populate the image from the database, where database have a url (text) from where image has to be loaded.
I am using Devexpress Winforms 9, and doing this in Layoutview repositoryitempictureedit.
Non of the given event is working so that I may intercept the loading and pass the image based on path given in database.
Please help me out if someone here using Devexpress controls.
Jay Khatri
ASKER
Actually the event LayoutView1_CustomUnboundC olumnData is not getting fired, first I thought it might be the problem that I have not used any unbound column, then I removed the columns from designer and specified like that:
Dim ds As New DataSet
str = "select * from scandocs scandocsreg where reg_id=" & Pubreg_id
ds = clscmn.Fill_DS(str)
LayoutView1.GridControl = GCdocs
LayoutView1.OptionsBehavio r.AutoPopu lateColumn s = False
GCdocs.DataSource = ds.Tables(0)
Dim colscandocid As DevExpress.XtraGrid.Column s.LayoutVi ewColumn = LayoutView1.Columns.AddFie ld("scando cid")
Dim colscancaption As DevExpress.XtraGrid.Column s.LayoutVi ewColumn = LayoutView1.Columns.AddFie ld("LastNa me")
Dim colscanurl As DevExpress.XtraGrid.Column s.LayoutVi ewColumn = LayoutView1.Columns.AddFie ld("Addres s")
' Access corresponding card fields.
Dim fieldscandocid As DevExpress.XtraGrid.Views. Layout.Lay outViewFie ld = colscandocid.LayoutViewFie ld
Dim fieldscancaption As DevExpress.XtraGrid.Views. Layout.Lay outViewFie ld = colscancaption.LayoutViewF ield
Dim fieldscanurl As DevExpress.XtraGrid.Views. Layout.Lay outViewFie ld = colscanurl.LayoutViewField
' Assign editors to card fields.
Dim riPictureEdit As DevExpress.XtraEditors.Rep ository.Re positoryIt emPictureE dit = GCdocs.RepositoryItems.Add ("PictureE dit")
colscanurl.ColumnEdit = riPictureEdit
this is the snippet of load event.
Please help me out if someone is using as I am completely puzzled with this.
Dim ds As New DataSet
str = "select * from scandocs scandocsreg where reg_id=" & Pubreg_id
ds = clscmn.Fill_DS(str)
LayoutView1.GridControl = GCdocs
LayoutView1.OptionsBehavio
GCdocs.DataSource = ds.Tables(0)
Dim colscandocid As DevExpress.XtraGrid.Column
Dim colscancaption As DevExpress.XtraGrid.Column
Dim colscanurl As DevExpress.XtraGrid.Column
' Access corresponding card fields.
Dim fieldscandocid As DevExpress.XtraGrid.Views.
Dim fieldscancaption As DevExpress.XtraGrid.Views.
Dim fieldscanurl As DevExpress.XtraGrid.Views.
' Assign editors to card fields.
Dim riPictureEdit As DevExpress.XtraEditors.Rep
colscanurl.ColumnEdit = riPictureEdit
this is the snippet of load event.
Please help me out if someone is using as I am completely puzzled with this.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The source code is not compatible with my environment, I think difference in dll and even IDE is not enabling to compile it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I checked all the parameters but still I am unbale to get the event fired gridView1_CustomUnboundCol umnData(By Val sender As Object, ByVal e As DevExpress.XtraGrid.Views. Base.Custo mColumnDat aEventArgs ) Handles LayoutView1.CustomUnboundC olumnData
found only the difference i.e. the vb form include the designer data and I my case a designer file is different lke myfle.designer.vb
and my data is initializing in form_load event.
found only the difference i.e. the vb form include the designer data and I my case a designer file is different lke myfle.designer.vb
and my data is initializing in form_load event.
How did you add the unbound column to the grid? Using the Designer?
ASKER
Ye using designer with fake datafield
All I can say now is that you keep experimenting and trial and error witht he project. Try to match the settings with those in the sample project etc.
You need to handle the DataBound / ItemDataBound event for the LayoutView. In that event, you need to call the FindControl() method on the LayoutView control to get your RepositoryItemPictureEdit control. Next, you need to get the data for the item being bound - this will give you the URL (text) for your image. You then need to load this image in your code and set it to the Image property of your RepositoryItemPictureEdit control.
I don't think there is a simpler way to do this unless you store the image itself in the database as binary data and simply bind it to the RepositoryItemPictureEdit control.