Binding GetAppUsers(); results to dropdownlist

Jun 19, 2009 at 11:51 PM

Hi all,

I am currently feeling my way about the 2.0 toolkit and learning C#, would like to add 'other friends who use the app' to a dropdownlist box. So far I have managed to get the userID's and append them to a string by using the below code, which gives me an appended string of the userids of friends who have added the app. Could anyone help out? Cheers.











public partial class friends : CanvasFBMLBasePage
    protected void Page_Load(object sender, EventArgs e)

        var strExcludeIds = GetAppUsers();
        TextBox1.Text = "Hello" +  strExcludeIds;
    private string GetAppUsers()
        var appUsers = Master.API.friends.getAppUsers();
        var sb = new StringBuilder();
        foreach (var friend in appUsers)
            sb.Append(friend + ",");
        if (sb.Length > 0) sb.Remove(sb.Length - 1, 1);
        return sb.ToString();

Jun 21, 2009 at 8:50 AM

Hi there - just to let you folks know I solved this by using the below code, places both the name and userid in the dropbox:

 IList<long> items = Master.API.friends.getAppUsers();
        //bind the items       
        ListItem li = null;       
        foreach (long friend in items)
            li = new ListItem(string.Format("{0}:{1}", Master.API.users.getInfo(friend).name, friend));