DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sat, 11 Aug 2007 16:59:40 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    GaryDean am
          2    Jesse Houwing
                 3    GaryDean am
                        4    Jesse Houwing
                        5    (Steven Cheng[MSFT])
                 6    GaryDean am
                        7    Jesse Houwing am


DataImageUrlField in DetailsView   
(This issue has already been posted by one of our developers (Tina) but I am 
reposting
it because it's urgent and I have the MSDN subscription so we are guessing I 
may
be more likely to get a response)

I can't get an image to show in a DetailsView.  I am trying both an
ImageField and a template field with an image in it with databindings to the
datasource.  I know the datasource works because the image shows in the
test.  All I get is the RED X.

I have google searched this problem and I have seen it reported several
times but never answered.  Is this a bug?  Is there a workaround?


here is my DetailsView definition......................
                <asp:DetailsView ID="dvDetails" runat="server" Height="50px"
Width="708px" AutoGenerateRows="False" DataSourceID="dsDetails">
                    <Fields>
                        <asp:CheckBoxField DataField="active"
HeaderText="active" SortExpression="active" />
                        <asp:BoundField DataField="numresumesposted"
HeaderText="numresumesposted" SortExpression="numresumesposted" />
                        <asp:BoundField DataField="address1"
HeaderText="address1" SortExpression="address1" />
                        <asp:BoundField DataField="hoursavailable"
HeaderText="hoursavailable" SortExpression="hoursavailable" />
                        <asp:BoundField DataField="maxhoursperweek"
HeaderText="maxhoursperweek" SortExpression="maxhoursperweek" />
                        <asp:BoundField DataField="resumetitle"
HeaderText="resumetitle" SortExpression="resumetitle" />
                        <asp:BoundField DataField="resumefilestring"
HeaderText="resumefilestring" SortExpression="resumefilestring" />
                        <asp:ImageField AccessibleHeaderText="Photo"
DataImageUrlField="photo">
                        </asp:ImageField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:Image ID="Image1" runat="server"
Height="166px" ImageUrl='<%# Eval("photo") %>'
                                    Width="175px" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Fields>
                </asp:DetailsView>

thanks,
Gary

-- 
Regards,
Gary Blakely
Date:Sat, 11 Aug 2007 16:59:40 -0700   Author:  

Re: DataImageUrlField in DetailsView   
Hello GaryDean,


> (This issue has already been posted by one of our developers (Tina)
> but I am
> reposting
> it because it's urgent and I have the MSDN subscription so we are
> guessing I
> may
> be more likely to get a response)
> I can't get an image to show in a DetailsView.  I am trying both an
> ImageField and a template field with an image in it with databindings
> to the datasource.  I know the datasource works because the image
> shows in the test.  All I get is the RED X.
> 
> I have google searched this problem and I have seen it reported
> several times but never answered.  Is this a bug?  Is there a
> workaround?
> 
> here is my DetailsView definition......................
> <asp:DetailsView ID="dvDetails" runat="server"
> Height="50px"
> Width="708px" AutoGenerateRows="False" DataSourceID="dsDetails">
> <Fields>
> <asp:CheckBoxField DataField="active"
> HeaderText="active" SortExpression="active" />
> <asp:BoundField DataField="numresumesposted"
> HeaderText="numresumesposted" SortExpression="numresumesposted" />
> <asp:BoundField DataField="address1"
> HeaderText="address1" SortExpression="address1" />
> <asp:BoundField DataField="hoursavailable"
> HeaderText="hoursavailable" SortExpression="hoursavailable" />
> <asp:BoundField DataField="maxhoursperweek"
> HeaderText="maxhoursperweek" SortExpression="maxhoursperweek" />
> <asp:BoundField DataField="resumetitle"
> HeaderText="resumetitle" SortExpression="resumetitle" />
> <asp:BoundField DataField="resumefilestring"
> HeaderText="resumefilestring" SortExpression="resumefilestring" />
> <asp:ImageField AccessibleHeaderText="Photo"
> DataImageUrlField="photo">
> </asp:ImageField>
> <asp:TemplateField>
> <ItemTemplate>
> <asp:Image ID="Image1" runat="server"
> Height="166px" ImageUrl='<%# Eval("photo") %>'
> Width="175px" />
> </ItemTemplate>
> </asp:TemplateField>
> </Fields>
> </asp:DetailsView>
> thanks,
> Gary


If the field photo contains the binary data to make up that image, you won't 
get it to work this way. Just think about it. Have you ever seen an HTML 
page where the binary contents of the image are embedded into the page itself? 
It's always a URL to the actual image.

So you will have to write a page (or better yet an httphandler) to stream 
the binary contents from the database. And in the grid you need to supply 
the image url with the url to that page/handler. 

There are a number or websites that explain this in detail.

http://www.codeproject.com/aspnet/ImageBinaryStream.asp
http://www.primaryobjects.com/CMS/Article59.aspx
http://www.codeguru.com/columns/vb/article.php/c14061/

Jesse
PS: My answering this question has nothign to do with the fact that you might 
have a MSDN subscription. The poeple answerign questions cannot see that 
in any way. Everybody is equal (just the MVP's a little more equal than the 
rest ;)).
Date:Sun, 12 Aug 2007 13:10:48 +0000 (UTC)   Author:  

Re: DataImageUrlField in DetailsView   
Jesse,
Thanks for the answer.  I have done images this way before but the docs say 
it can be done the way we were trying - thought there might be some 
automatically generated streaming in the control somehow.

BTW, along with an MSDN subscription comes a "gaurantee" of a response 
within either 24 or 48 hours in these newsgroups from a Microsoft support 
person.  I have used this for years.  Look at responses to my postings and 
you will see that along with community answers, I get microsoft responses to 
all of my postings

-- 
Regards,
Gary Blakely
Dean Blakely & Associates
www.deanblakely.com

"Jesse Houwing"  wrote in message 
news:21effc90dc0b8c9ab0a19356abd@news.microsoft.com...

> Hello GaryDean,
>
>> (This issue has already been posted by one of our developers (Tina)
>> but I am
>> reposting
>> it because it's urgent and I have the MSDN subscription so we are
>> guessing I
>> may
>> be more likely to get a response)
>> I can't get an image to show in a DetailsView.  I am trying both an
>> ImageField and a template field with an image in it with databindings
>> to the datasource.  I know the datasource works because the image
>> shows in the test.  All I get is the RED X.
>>
>> I have google searched this problem and I have seen it reported
>> several times but never answered.  Is this a bug?  Is there a
>> workaround?
>>
>> here is my DetailsView definition......................
>> <asp:DetailsView ID="dvDetails" runat="server"
>> Height="50px"
>> Width="708px" AutoGenerateRows="False" DataSourceID="dsDetails">
>> <Fields>
>> <asp:CheckBoxField DataField="active"
>> HeaderText="active" SortExpression="active" />
>> <asp:BoundField DataField="numresumesposted"
>> HeaderText="numresumesposted" SortExpression="numresumesposted" />
>> <asp:BoundField DataField="address1"
>> HeaderText="address1" SortExpression="address1" />
>> <asp:BoundField DataField="hoursavailable"
>> HeaderText="hoursavailable" SortExpression="hoursavailable" />
>> <asp:BoundField DataField="maxhoursperweek"
>> HeaderText="maxhoursperweek" SortExpression="maxhoursperweek" />
>> <asp:BoundField DataField="resumetitle"
>> HeaderText="resumetitle" SortExpression="resumetitle" />
>> <asp:BoundField DataField="resumefilestring"
>> HeaderText="resumefilestring" SortExpression="resumefilestring" />
>> <asp:ImageField AccessibleHeaderText="Photo"
>> DataImageUrlField="photo">
>> </asp:ImageField>
>> <asp:TemplateField>
>> <ItemTemplate>
>> <asp:Image ID="Image1" runat="server"
>> Height="166px" ImageUrl='<%# Eval("photo") %>'
>> Width="175px" />
>> </ItemTemplate>
>> </asp:TemplateField>
>> </Fields>
>> </asp:DetailsView>
>> thanks,
>> Gary
>
> If the field photo contains the binary data to make up that image, you 
> won't get it to work this way. Just think about it. Have you ever seen an 
> HTML page where the binary contents of the image are embedded into the 
> page itself? It's always a URL to the actual image.
>
> So you will have to write a page (or better yet an httphandler) to stream 
> the binary contents from the database. And in the grid you need to supply 
> the image url with the url to that page/handler.
> There are a number or websites that explain this in detail.
>
> http://www.codeproject.com/aspnet/ImageBinaryStream.asp
> http://www.primaryobjects.com/CMS/Article59.aspx
> http://www.codeguru.com/columns/vb/article.php/c14061/
>
> Jesse
> PS: My answering this question has nothign to do with the fact that you 
> might have a MSDN subscription. The poeple answerign questions cannot see 
> that in any way. Everybody is equal (just the MVP's a little more equal 
> than the rest ;)).
>
> 
Date:Sun, 12 Aug 2007 09:32:48 -0700   Author:  

Re: DataImageUrlField in DetailsView   
Hello GaryDean,


> Jesse,
> Thanks for the answer.  I have done images this way before but the
> docs say
> it can be done the way we were trying - thought there might be some
> automatically generated streaming in the control somehow.


Can you copy paste that section from the docs? I've never before seen anything 
that allowed tyou to put in a bunch of data in an URL property and have it 
automagically streamed as a seperate http request. I think you might have 
misinterpreted it.


> BTW, along with an MSDN subscription comes a "gaurantee" of a response
> within either 24 or 48 hours in these newsgroups from a Microsoft
> support person.  I have used this for years.  Look at responses to my
> postings and you will see that along with community answers, I get
> microsoft responses to all of my postings


There's a lot of non microsoft people here as well. But yes you are right. 

Jesse




> 
> "Jesse Houwing"  wrote in message
> news:21effc90dc0b8c9ab0a19356abd@news.microsoft.com...
> 
>> Hello GaryDean,
>> 
>>> (This issue has already been posted by one of our developers (Tina)
>>> but I am
>>> reposting
>>> it because it's urgent and I have the MSDN subscription so we are
>>> guessing I
>>> may
>>> be more likely to get a response)
>>> I can't get an image to show in a DetailsView.  I am trying both an
>>> ImageField and a template field with an image in it with
>>> databindings
>>> to the datasource.  I know the datasource works because the image
>>> shows in the test.  All I get is the RED X.
>>> I have google searched this problem and I have seen it reported
>>> several times but never answered.  Is this a bug?  Is there a
>>> workaround?
>>> 
>>> here is my DetailsView definition......................
>>> <asp:DetailsView ID="dvDetails" runat="server"
>>> Height="50px"
>>> Width="708px" AutoGenerateRows="False" DataSourceID="dsDetails">
>>> <Fields>
>>> <asp:CheckBoxField DataField="active"
>>> HeaderText="active" SortExpression="active" />
>>> <asp:BoundField DataField="numresumesposted"
>>> HeaderText="numresumesposted" SortExpression="numresumesposted" />
>>> <asp:BoundField DataField="address1"
>>> HeaderText="address1" SortExpression="address1" />
>>> <asp:BoundField DataField="hoursavailable"
>>> HeaderText="hoursavailable" SortExpression="hoursavailable" />
>>> <asp:BoundField DataField="maxhoursperweek"
>>> HeaderText="maxhoursperweek" SortExpression="maxhoursperweek" />
>>> <asp:BoundField DataField="resumetitle"
>>> HeaderText="resumetitle" SortExpression="resumetitle" />
>>> <asp:BoundField DataField="resumefilestring"
>>> HeaderText="resumefilestring" SortExpression="resumefilestring" />
>>> <asp:ImageField AccessibleHeaderText="Photo"
>>> DataImageUrlField="photo">
>>> </asp:ImageField>
>>> <asp:TemplateField>
>>> <ItemTemplate>
>>> <asp:Image ID="Image1" runat="server"
>>> Height="166px" ImageUrl='<%# Eval("photo") %>'
>>> Width="175px" />
>>> </ItemTemplate>
>>> </asp:TemplateField>
>>> </Fields>
>>> </asp:DetailsView>
>>> thanks,
>>> Gary
>> If the field photo contains the binary data to make up that image,
>> you won't get it to work this way. Just think about it. Have you ever
>> seen an HTML page where the binary contents of the image are embedded
>> into the page itself? It's always a URL to the actual image.
>> 
>> So you will have to write a page (or better yet an httphandler) to
>> stream
>> the binary contents from the database. And in the grid you need to
>> supply
>> the image url with the url to that page/handler.
>> There are a number or websites that explain this in detail.
>> http://www.codeproject.com/aspnet/ImageBinaryStream.asp
>> http://www.primaryobjects.com/CMS/Article59.aspx
>> http://www.codeguru.com/columns/vb/article.php/c14061/
>> 
>> Jesse
>> PS: My answering this question has nothign to do with the fact that
>> you
>> might have a MSDN subscription. The poeple answerign questions cannot
>> see
>> that in any way. Everybody is equal (just the MVP's a little more
>> equal
>> than the rest ;)).
Date:Sun, 12 Aug 2007 16:58:41 +0000 (UTC)   Author:  

Re: DataImageUrlField in DetailsView   
Jesse,
Another thought....
If what you say is true then what is the purpose of the DataImageUrlField in 
the fields editor of the DetailsView?  It simply points to the image 
column - not a web page that streams.

-- 
Regards,
Gary Blakely
Dean Blakely & Associates
www.deanblakely.com
"Jesse Houwing"  wrote in message 
news:21effc90dc0b8c9ab0a19356abd@news.microsoft.com...

> Hello GaryDean,
>
>> (This issue has already been posted by one of our developers (Tina)
>> but I am
>> reposting
>> it because it's urgent and I have the MSDN subscription so we are
>> guessing I
>> may
>> be more likely to get a response)
>> I can't get an image to show in a DetailsView.  I am trying both an
>> ImageField and a template field with an image in it with databindings
>> to the datasource.  I know the datasource works because the image
>> shows in the test.  All I get is the RED X.
>>
>> I have google searched this problem and I have seen it reported
>> several times but never answered.  Is this a bug?  Is there a
>> workaround?
>>
>> here is my DetailsView definition......................
>> <asp:DetailsView ID="dvDetails" runat="server"
>> Height="50px"
>> Width="708px" AutoGenerateRows="False" DataSourceID="dsDetails">
>> <Fields>
>> <asp:CheckBoxField DataField="active"
>> HeaderText="active" SortExpression="active" />
>> <asp:BoundField DataField="numresumesposted"
>> HeaderText="numresumesposted" SortExpression="numresumesposted" />
>> <asp:BoundField DataField="address1"
>> HeaderText="address1" SortExpression="address1" />
>> <asp:BoundField DataField="hoursavailable"
>> HeaderText="hoursavailable" SortExpression="hoursavailable" />
>> <asp:BoundField DataField="maxhoursperweek"
>> HeaderText="maxhoursperweek" SortExpression="maxhoursperweek" />
>> <asp:BoundField DataField="resumetitle"
>> HeaderText="resumetitle" SortExpression="resumetitle" />
>> <asp:BoundField DataField="resumefilestring"
>> HeaderText="resumefilestring" SortExpression="resumefilestring" />
>> <asp:ImageField AccessibleHeaderText="Photo"
>> DataImageUrlField="photo">
>> </asp:ImageField>
>> <asp:TemplateField>
>> <ItemTemplate>
>> <asp:Image ID="Image1" runat="server"
>> Height="166px" ImageUrl='<%# Eval("photo") %>'
>> Width="175px" />
>> </ItemTemplate>
>> </asp:TemplateField>
>> </Fields>
>> </asp:DetailsView>
>> thanks,
>> Gary
>
> If the field photo contains the binary data to make up that image, you 
> won't get it to work this way. Just think about it. Have you ever seen an 
> HTML page where the binary contents of the image are embedded into the 
> page itself? It's always a URL to the actual image.
>
> So you will have to write a page (or better yet an httphandler) to stream 
> the binary contents from the database. And in the grid you need to supply 
> the image url with the url to that page/handler.
> There are a number or websites that explain this in detail.
>
> http://www.codeproject.com/aspnet/ImageBinaryStream.asp
> http://www.primaryobjects.com/CMS/Article59.aspx
> http://www.codeguru.com/columns/vb/article.php/c14061/
>
> Jesse
> PS: My answering this question has nothign to do with the fact that you 
> might have a MSDN subscription. The poeple answerign questions cannot see 
> that in any way. Everybody is equal (just the MVP's a little more equal 
> than the rest ;)).
>
> 
Date:Sun, 12 Aug 2007 10:14:36 -0700   Author:  

Re: DataImageUrlField in DetailsView   
Hello GaryDean,


> Jesse,
> Another thought....
> If what you say is true then what is the purpose of the
> DataImageUrlField in
> the fields editor of the DetailsView?  It simply points to the image
> column - not a web page that streams.


See the docs here:
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.imagefield.dataimageurlfield.aspx

it is used to set up a format to use when binding to the datasource. So if 
your datasource contaisn only the name of the image, or your download url 
needs the name of the image as a parameter you can use this property in combination 
with the dataimageurlformatstring field.

          <asp:imagefield dataimageurlfield="LastName"
            dataimageurlformatstring="~\Images\{0}.jpg"
            alternatetext="Employee Photo"
            nulldisplaytext="No image on file."
            headertext="Photo"  
            readonly="true"/>

So it will pick the contents of the LastName column and merge that into the 
dataimageurlformatstring.

The example on the page would pick all the lastnames drom the bindingsource 
to build the url.

So it doesn't allow you to stream the data directly from the dataset. it 
just makes it easier to setup the url to stream the actual data from. You 
still need a page to fetch the data from the database or an image on disk 
somewhere.

--
Jesse Houwing
Date:Sun, 12 Aug 2007 17:15:08 +0000 (UTC)   Author:  

Re: DataImageUrlField in DetailsView   
Thanks for Jesse's inputs,

Hi Gary,

As for the DataImageUrlField, as Jesse has said, it simply display the 
value from databound field onto html page, and the value it expected is a 
simple string path. e.g.  "/images/logo.jpg" 

And web page databinding is different from winform databinding which can 
not directly bind and display binary stream data(such as image) and display 
them inside a web page. If the data of your image field is of binary 
stream, you may need to use another spearate httphandler to expose them and 
refer the httphandler based url in your DetailsView's image column.

If the data in your image datafield does be of string path value, I think 
there might exists some problem with the resolution of the image path at 
either server-side or client-side.  A common way to troubleshoot is as 
below:

** view the page's client-side html source in brower to see whether the 
output path is the expected correct path

** print out the path value which is bound in DetailsView to see whether it 
is the correct one.

Anyway, if there is anything else particular in your scenario or if you 
have any more specific question on this, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

 

==================================================

Get notification to my posts through email? Please refer to 
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

 

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues 
where an initial response from the community or a Microsoft Support 
Engineer within 1 business day is acceptable. Please note that each follow 
up response may take approximately 2 business days as the support 
professional working with you may need further investigation to reach the 
most efficient resolution. The offering is not appropriate for situations 
that require urgent, real-time or phone-based interactions or complex 
project analysis and dump analysis issues. Issues of this nature are best 
handled working with a dedicated Microsoft Support Engineer by contacting 
Microsoft Customer Support Services (CSS) at 
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================
 	

This posting is provided "AS IS" with no warranties, and confers no rights.
Date:Mon, 13 Aug 2007 02:58:21 GMT   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us