Monday, February 8, 2010

How to display images in DataList control in asp.net C#?

Hi Experts,


Please help me .I want to display images in DataList control from a folder that is placed in asp.net websit project. I want to display images in


three columns and three rows in DataList.





Please give your valuable advices!


Thanks


JamesHow to display images in DataList control in asp.net C#?
- First what you'll need to do is put the file names in a field in some sort of database table like Access or MS SQL.


- Then you can configure the data source of the DataList to that table. - One you've done that go into the Property Builder and set it to 3 columns for the repeat layout.


-Then in design mode, edit the template and remove the label that is bound to the file name.


- Add an ImageControl.


- Configure the DataBinding of the ImageURL to the field in your table that has the file names.


- Change the format to point to your file location (so if your images were in a folder called ';Images'; in your root you would format it like ';~/Images/{0}';





And that is it! Hope that helps. I can make a quick walk through video if you need to see it done. Let me know! phillip.stricker@gmail.com

No comments:

Post a Comment