Quantcast
Channel: DataSource Controls - SqlDataSource, ObjectDataSource, etc.
Viewing all articles
Browse latest Browse all 956

How do I retrieve the first item in a CharArray to display in ListView

$
0
0

I have a CharArray that contains this informaiton.

https://www.website.com/filename.jpg,https://www.website.com/filename2.jpg,https://www.website.com/filename3.jpg,https://www.website.com/filename4.jpg

I can list all the image URL's in a ListView fine with this query

var photos = new EntityContainer();
        string photoUrls = (from p in content.Inventories
                            select p.ImageList).FirstOrDefault();

        string[] values = photoUrls.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
        PhotoListRepeater.DataSource = values;
        PhotoListRepeater.DataBind();

But how do I retrieve only the first record in the DataSource so the result would be the first image in the list?

Thanks in advance


Viewing all articles
Browse latest Browse all 956

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>