We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to render an image along with the description by using the listview control in MVC?

You can render an image along with the description by using the Template feature in the ListView. To achieve this, create a model that contains the data. Refer to the following code example.

ListTemplate.cs

Then create the controller and pass the information that is created in the above model file. Refer to the following code example.

ListViewController.cs

Now, create a view that contains the listview controls with template items.

index.cshtml

For a better alignment and image rendering, add the following style section to the view.

Style

 

Output

Article ID: Published Date: Last Revised Date: Platform: Control:
4240 03/05/2015 03/05/2015 ASP.NET MVC ListView
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.