views:

22

answers:

2

hello guys,

i have a problem and hope that somebody can help me.

i am developing in vb.net. i have a gridview with a template field, in which i have a asp:image tag. But the browser dont show any image. i does not render the image. if i check the sourccode in the browser there is no image tag. But the visual web developer show the image. i tried all avriation of paths.

    <asp:TemplateField>
                         <ItemTemplate>
                             <asp:Image ID="Image1" runat="server" ImageUrl="~/ProfilePictures/icon.png" />
                          </ItemTemplate>
                      </asp:TemplateField>

Have any body an idea why this happens ?

Best regards

A: 

If the image tag isn't being rendered then that suggests that the visibility of this particular column may be set to false (or even the image itself).

Joel Etherton
i tried Visible="true" but it does not work ( it even does not render). is tit possible to control the visibilty of the columns in the gridview tag ?
@user389431 - The visibility of the columns is controllable from several places.
Joel Etherton
A: 

Have you definitely bound data to the control you are using?

If not, then the Design view will display the image as it is giving you a preview of what the databound control will look like, but when running the website page, the control will not display anything if not bound.

edit 1 @user389431

Controlname.DataSource = yourdatasource
Controlname.Databind()

yourdatasource can be many things.

I just assumed you were binding data to the control as you are using the <asp:TemplateField>

Try putting the image outwith the TemplateField to see if it displays.

edit 2 @user389431

Ok, looks like you are binding the control ok, my next thing to check would be that getCont.GetAllMessagesFromThisForumId(ConversationID) actually has any values in it. So Debug the code, step through it, and check to see if it has values.

Tim B James
Outside the Template it does NOT show the image too. can there be something wrong in the web.config file ?
GetAllMessagesFromThisForumId works. cause i show other contents like forumId or messageContent too, and this things will showed without problems. i think there is something wrong with asp:TemplateField. cause if i try labels, they will not showed, BUT rendered.
could you post a bit more of the aspx page?
Tim B James