dearness
asked on
What directory path do I use to display an image in a gridview for publishing.
I have tried what seems like 100 combinations of directory paths to display an image in a Gridview after publishing and I cant get any to work. The images show in development debugging mode but after publishing nothing. The path for the images comes from an Access database field, example....
~\Images\TICK.jpg
The published virtual directory is C:\MRO and the images are in folder C:\MRO\Images
I had a similar problem getting a document from a folder in code, server.mapPath(..
fixed that but this is different.
~\Images\TICK.jpg
The published virtual directory is C:\MRO and the images are in folder C:\MRO\Images
I had a similar problem getting a document from a folder in code, server.mapPath(..
fixed that but this is different.
ASKER
If I set the NullImageUrl property in the datagridview column it displays correctly when published.
<asp:ImageField DataImageUrlField="PHOTO" HeaderText="PHOTO"
NullImageUrl="~/Images/nop ictureicon web.gif">
</asp:ImageField>
<asp:ImageField DataImageUrlField="PHOTO" HeaderText="PHOTO"
NullImageUrl="~/Images/nop
</asp:ImageField>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the reply,
this wont work in development or published.
this wont work in development or published.
ASKER
I hope this extra information can help solve the problem.
I added another column and bound it to the same field in the database.
<asp:BoundField DataField="PHOTO" HeaderText="PHOTO" />
<asp:ImageField DataImageUrlField="PHOTO" HeaderText="PHOTO"
NullImageUrl="~/Images/nop ictureicon web.gif">
</asp:ImageField>
In development I get the URL and picture showing, URL shows as
~/Images/TICK.jpg
After publishing, the URL and picture will not show. For some reason that one database field is not being read, all other columns show correct database data.
I added another column and bound it to the same field in the database.
<asp:BoundField DataField="PHOTO" HeaderText="PHOTO" />
<asp:ImageField DataImageUrlField="PHOTO" HeaderText="PHOTO"
NullImageUrl="~/Images/nop
</asp:ImageField>
In development I get the URL and picture showing, URL shows as
~/Images/TICK.jpg
After publishing, the URL and picture will not show. For some reason that one database field is not being read, all other columns show correct database data.
ASKER
A small break through with this. I am finding the web server is not displaying the latest data from the database, If I change data in the database columns the changed dont show in the browser. The server is displaying old information!. Since I added the photo column last after testing, it is not being read. IS there something I need to do at the server? I am Caching the data in an application object.
Dim daDB As New dsMROTableAdapters.tblMROT ableAdapte r
Dim dtDB As New System.Data.DataTable
dtDB = daDB.selectFullDatabase
'get the pm information from strongly typed data adapter
Application.Lock()
Application("dtDatabase") = dtDB
Application.UnLock()
Protected Sub btnMRO_Search_Click(sender As Object, e As System.EventArgs) Handles btnMRO_Search.Click
Dim modifiedText As String
Dim dtMRO As New DataTable
dtMRO = Application("dtDatabase")
'search for MRO number
If txtMRO_Search.Text <> "" Then..................
I get the feeling this is where I am going wrong?
Dim daDB As New dsMROTableAdapters.tblMROT
Dim dtDB As New System.Data.DataTable
dtDB = daDB.selectFullDatabase
'get the pm information from strongly typed data adapter
Application.Lock()
Application("dtDatabase") = dtDB
Application.UnLock()
Protected Sub btnMRO_Search_Click(sender
Dim modifiedText As String
Dim dtMRO As New DataTable
dtMRO = Application("dtDatabase")
'search for MRO number
If txtMRO_Search.Text <> "" Then..................
I get the feeling this is where I am going wrong?
ASKER
OK, I have just given myself a hard lesson on how using application caching while testing works. The cache is doing exactly what its is supposed to do.
Great, you did it yourself.
One point to can be noticed here that the ~ sign works only for the serverside controls not html controls.
One point to can be noticed here that the ~ sign works only for the serverside controls not html controls.
ASKER
<td>E10</td><td>SANDPAPER,
Source code after deployment.....
<td>E10</td><td>SANDPAPER,