I have an application that loads all of my content types into a drop down list. When an item in the drop down list is selected I would like to get a list of the columns for that content type but each one only returns Title and ContentType. Here is the code I am using:
protected void ddl_ContentTypes_SelectedIndexChanged(object sender, EventArgs e)
{
SPContentType ct = new SPContentType(SPBuiltInContentTypeId.Document,SPContext.Current.Web.ContentTypes,ddl_ContentTypes.SelectedValue);
foreach (SPField f in ct.Fields)
{
//do stuff with each field. Only returns Title and ContentType
}
}
Is there something I should be doing differently. Is it bad that I am using the built in Document content type for the ParentContentType?