:) Great. That's exactly what I was after. Thank you! One more question surrounding "using". Whenever I use using I get web part errors saying that the data has already been disposed. This usually occurs when trying to edit the web part properties. As a result, I now just do the folowing but am unsure as to whether this needs to be disposed at some point? try { oList = SPContext.Current.Web.Lists[oListName];
From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Salman Ahmad Sent: Thursday, 3 November 2011 6:29 PM To: ozMOSS Subject: Re: Return only spfields that are filterable my bad, I missed actual condition, foreach (SPField field in fieldsCollection) { if (field.Filterable) { Console.WriteLine(field.Title); fieldsList.Add(field); } } Cheers, From: Salman Ahmad<mailto:salman.ah...@msn.com> Sent: Thursday, November 03, 2011 11:24 AM To: ozMOSS<mailto:ozmoss@ozmoss.com> Subject: Re: Return only spfields that are filterable Hi Paul, Here is a sample you can start with. using(SPSite site = new SPSite("http://localhost")) using (SPWeb web = site.OpenWeb()) { List<SPField> fieldsList = new List<SPField>(); SPFieldCollection fieldsCollection = web.Fields; foreach (SPField field in fieldsCollection) { Console.WriteLine(field.Title); fieldsList.Add(field); } } Use fieldsList to populate your DropDownList. You can also get Fields Collection for your lists in the same way, Cheers, Salman From: Paul Noone<mailto:paul.no...@ceosyd.catholic.edu.au> Sent: Thursday, November 03, 2011 8:52 AM To: mailto:ozmoss@ozmoss.com Subject: Return only spfields that are filterable Can anyone provide an example of how I can use the SPField.Filterable property to return all fields where this is true? I want to use this to dynamically populate a DropDownList control. ________________________________ _______________________________________________ ozmoss mailing list ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss ________________________________ _______________________________________________ ozmoss mailing list ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
_______________________________________________ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss