How to display records in a GridView?

marksquall

Active member
Joined
Oct 17, 2009
Messages
28
Programming Experience
3-5
Dearest VB.NetForum members:

Hello, and a pleasant day to all.

I am currently learning ASP .NET with Database connection (using MS Access) and I wonder how to display the content of MSAccess database table in the webpage if the column stores the directory path of the image. Here are the column names of my table Pet:

  • PetID
  • PetType
  • PetName
  • ImgLocation
Here is one example of what a content look like (this is actually my first record):

  • PetID = 001
  • PetType = dog
  • PetName = German Shepherd
  • ImgLocation = C:\inetpub\wwwroot\MyWebService\images\german_sheperd.jpg
There are a minimum of 10 records I am currently working at.

But I am having trouble displaying the information of the image. There is no problem with the texts, just the images...

And in addition, I want to display the pet information a little more attractive, is there any downloadable CSS that I may apply to any ASP Control like ListView or GridView to make it more presentable?


Thank you and more power to all.

Respectfully yours,

Mark Ryan
 
Hi, Mark Ryan

It is not clear from your question how you coded to display image. But you can try following code snippet.

If you uses 'DataImageUrlField' to display your image with full path in your grid view,then I suggest to use 'ImageUrl' instead to display your image.

Ex.: <asp:Image ID="Image1" Height = "100" Width = "100" runat="server" ImageUrl='<%# ResolveUrl(Eval("Your image path url here").ToString()) %>' />
 
Back
Top