Bind PhotoSets to DropDownList

Topics: Developer Forum
Mar 15, 2011 at 8:54 PM

I'm new to and FlickrNet. I have got the FlickrNet demo working but I now need to bind Photosets to an dropdownlist.

Can someone please point me in the right direction. As you can tell from the question .... I am just a beginner

Mar 15, 2011 at 9:12 PM

Simply set DataTextField to the field you want to display (probably "Name") and DataValueField to "PhotosetId" then set DataSource to the PhotosetsCollection.

If you are having problems getting this working then show us some code (and make it as simple an example as you can).


Mar 16, 2011 at 12:03 AM

Hi Sam,

Forgot to say a huge thanks for all your work so far. Awesome!

Here is my code behind page default2.aspx.vb

Imports FlickrNet
Partial Class Default2
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim flickr As New Flickr()

        Dim PhotoSetOwner = ConfigurationManager.AppSettings("FlickrUserId")
        Dim PhotoSetList = flickr.PhotosetsGetList(PhotoSetOwner)
        DropDownListPhotoSets.DataSource = PhotoSetList
        DropDownListPhotoSets.DataTextField = "Title"
        DropDownListPhotoSets.DataValueField = "PhotosetId"
    End Sub
End Class

and my default2.aspx contains a dropdownlist

<asp:DropDownList ID="DropDownListPhotoSets" runat="server" >

I'm really struggling though

Mar 16, 2011 at 7:08 AM

I think you need to call DataBind() after you've set DataTextField and DataValueField. I'll give it a go myself later.