.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Determining the Content Type of a new item

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :C#

I seem to have painted myself into a corner. The short story: I have a list that supports three different content types, all of which share a lookup column called Template. As a new item is added I want to be able to filter the Template items based on which content type is being applied. Is there any way to determine the content type before the new item form has finished loading? If I can determine what the content type is I'm thinking I could use JQuery to remove the Template items I don't want. 


View Complete Post

More Related Resource Links

Create buttons for "new item" which create a new page of a specific content type

We have a Pages library (wiki) which supports a few content types (and page layout associated). We want to enable users to click a button for example of "new custom enterprise wiki page" - so a new page of content type article will be open in edit mode. Can someone help how to develop? (it has to mimic the behavior that happens when user creates new page from the Ribbon or Site actions and has to choose the content type, it also has to keep the new page in edit mode and not just create it).  

Issue with Announcement content type and adding a new item



I have the following issue with the (Silverlight?) form to add a new item:If the screen has many fields so scroll bars appear (i.e. it's longer than the screen), you can move up and down. YET, if you press to attach a file, the scroll bars dissapear, so you can't see the rest of the form.

To reproduce: 

a) make an annoucement list

b) Add a choice field, add many choises and enable multiple values - in order to have a longer-than-the-screen input form.

c) Go to the list , press add-new-item and attach a file: After that, you won;t be able to see all the input form.



http 400 Error when performing item upload after setting custom edit form on content type



What I am trying to do is create custom edit forms for different content types within the same document library.....so basically I have done the following:

  • I have created two site content types and reconfigured my library to use CT's. 
  • I then connected to my site using SPD. 
  • When examining my library I can see that I have the two CT that I added earlier.  I then created a new editform for one the CTs using the top ribbon menu and in the drop down box associated it to the CT.  I did not select this as the default form for the library.
  • I then updated the library CT (not site CT) with the url to form in the editform properties.

When I create a document and edit the properties it works fine - totally as expected.  However when I upload a document the default EditForm for the library is used and I can select the CT to associate the document to.  When I choose the CT with the custom form the new edit form is not found and I get a page not found error - http 400.

The full url for this library is is http://XXXX/functions/ehs/CSI

So the URL I have used is /functions/ehs/CSI/Forms/EditForm2.aspx (EditForm2.aspx) is my form and this is fine.  I have even used CSI/Forms/EditForm2.aspx and this works...  BUT ne

Add new item link to create a no-default content type item


I have a contacts list in which there is a company and person content type. The default content type is person, given they will be the most commonly created item. However, I want to create a link on a different page that links to create a company. The link created correctly launches the company contact form, but for some reason creates the contact as a person contact (i.e. the default) instead of a company content type.

My link is: https://MyServer/MySite/Lists/MyList/NewCompanyContact.aspx?List=0b73f0cb%2Deb48%2D4a25%2Da817%2Dc89f930e19a5&RootFolder=%2FBusinessDevelopment%2FLists%2FContacts&ContentTypeId=0x01007B29F47C6BF470468E8EA02DD8570DFF001DA7CBDD0D967F498114C805487BEA38&IsDlg=1 

Am I missing something?

Cheers, Theo

Using Additional Fields from External Content Type in InfoPath 2010 External Item Picker


Hello, we've created an external content type for our store locations. Each location in the content type has a name, id, manager, region and so on. When we use this BCS content type as a field in a list, we are given the option to "Add a column to show each of these additional fields"

What would the equivalent be in an InfoPath form? When we add an External Item Picker to a form a number of fields are included in the form's data source, including a repeating group called BDCEntity with the following fields:

  • EntityDisplayName
  • EntityInstanceReference
  • EntityId1
  • EntityId2
  • EntityId3
  • EntityId4
  • EntityId5

Entity display name appears to be what we configure as the Display Field Name in the picker properties, and the EntityId1 is the location ID, which is the identifier on the external content type. EntityId2-5 are all blank.

We use region and other location attributes in workflows so how can we access all these other fields?

Thanks for your time.

Peter Newhook SharePoint posts on my blog

WSS 3.0 Content Type with Office 2007


We're currently encoutering an issue on our production servers with Office 2007 documents. In essence, the Content Type for all docx, xslx, and pptx documents cannot be changed away from the site default on all newly created sites.

I've even done some step by step debugging on an SPItem insert and I can set the content type to a custom type, but it reverts back to the site's default Content Type on Update(). Other file types - .doc, .xls, .tif, .txt, and .jpg - have all been tested, and all work as expected (the Content Type changes correctly).

Thanks in advance!


WSS 3.0 Content Type - Lost data for Titles


We are running WSS 3.0 SP2 on server 2003.  Recently, we lost the "Titles" for all content types for documents.  Our system Content Type for Document is set up to require this field to be completed on all documents that is uploaded.  Our system would automatically enter in by default the name of the document in the "Title" field it no longer does this for the user.  The user must now enter in manually the "Title".  How do I get it to enter in the "Title" using the document file name automatically?

Below is the way the setting page for Site Content Type: Document looks like.  (I tried to recreate it since I could place a screen shot in the box)

Site Content Type Information
Name:  Document
Descriptiong:  Create a new document.
Parent:  Item
Group:   Document Content Types

Name, Description, and group
Advanced settings
Workflow settings
Delete this site content type

Name                 Type                     &nb

BCS Updater Method in External Content type


HI, I have a List (External Content type ) with CRUD methods written.for example. Employee with fields






If want to update only Remarks field and want to display the other fields.(other field should not be editable). How can i do it throught VS2010. If I made those fields readOnly and preupdaterField true. those fields not displays while editing. I want to show those fields but not to edit. any suggestions????

2)while displaying (ReadList )if I want to display only EmpName and EmpID.How can i do it?


or please try to give some links about all the properties for a Type Decriptor and how they are related with CRUD methods.



SharePoint 2007 - Consolidating everything as feature into WSP [Content Type, Page Layout, Pages, Ma


Hello –


Overview – We are building a Mobile Web Site using SharePoint 2007. The big screen site has been already built and we need to integrate the mobile site into same site collection of big screen –


·         The Mobile site will use the existing content types of existing big screen site

·         We will build a new custom Master page

Issue with List Definition of same base content type and deployed via same feature


I am trying to deploy two custom list definitions using only one single feature.  Below are the details of my issue.

  • Two custom list definitions
  • Each custom list definition has its own custom content type
  • Each custom content type inherits from the base content type Picture (Type = 109)
  • The custom list definitions are grouped together under one single feature
  • The custom content types are grouped together under a seperate single feature

When I deploy my solution in this configuration, the second list definition gets the first custom content type applied to it and the list schema from the first list definition is also applied to the second list definition.

What makes this more interesting, when I seperate both of the list definitions under two seperate features it all works fine.  Custom content types and list schemas get applied correctly.

Can anyone tell me why I can not deploy both list definitions under one single feature?

If you need me to post any of the origional code or XML to this post please let me know.



Content Type Saved Incorrectly Using DataView


I have created a blank web part page and added a data view for my selected list in which I have enabled the insert/edit/delete options.  In that data view I have included the content type field (my list has 3 content types).  I am using JavaScript to set some fields defaults and to hide those fields, one being the content type field.  All seems to work correctly when submittin a new entry except that each item I save is always saved as the 1st content type.  I have tried inserting a new item without any JavaScript and have the same problem - no matter which content type I select from the drop-down list the item is always saved as the 1st content type.  Am I missing something here?  Surely I don't have to use the standard list form to insert new items into my list as I need to be able to control the user's interaction using the options available in the data view.

SharePoint Server 2007, SPD 2007, both SP2.

Thanks for any insight!

Creating SharePoint Server 2010 External Content Type Associations with SharePoint Designer 2010

Learn how to use Business Connectivity Services (BCS) to create associations between external content types in SharePoint Designer 2010 without using code.

Record Center and content type of the incoming documents


Hello all

I have same content types in both collboration site and record center sites.

When I used Send To command to send a document from collaboration area to record center, all the properties and metadata are promoted to columns in the Record center library. But the Content type of the document in record center is set to "Document" even though the incoming document's metadata has Content type value. Will all the records end up as Document content type if we are using default router?



Kiran Bellala

User control with multiple item content

I have a user control that I would like to contain multiple items as its content, similar to the way a <StackPanel> works. I tried using a <ContentPresent/> but it will only let me use a single item as the control's content. What's the best way to go about this? I realize I could just require the user to put a <StackPanel> or <Grid> or similar control as the content of the user control, but i would rather not do that if possible.   I'm not sure if it matters, but this control actually has several content presenters. Some of them will contain a single item and some will contain multiple items.

Read an XML file, setting uname/pw, Accept, Content-Type

Hi; To read some REST XML data we need to set the username, password, and tell it for the http request Accept: application/xml Content-Type: application/xml Is there a sample anywhere showing how to do this? thanks - daveVery funny video - Reporting as a Metaphor

DropDownList problems : The ViewData item that has the key 'userTYPE_id_user_type' is of type 'Sy

Hello,I've been searching for that problem for hours...I have two table :          -user          -userTypeI'm trying to create a user, wich as a column id_userType, so I'm trying to do a dropdownlist with the userType List I've that error code : The ViewData item that has the key 'userTYPE_id_user_type' is of type 'System.Int32' but must be of type 'IEnumerable<SelectListItem>'. // // GET: /User/Create public ActionResult Create() { //Send to the view, the userTypeList IEnumerable<SelectListItem> userTypeList = new SelectList(_userRepository.FindAllUserType().Distinct().ToList(), "id_user_type", "Description"); ViewData["userType_id_user_type"] = userTypeList; return View(); } here the post controller // // POST: /User/Create [HttpPost] public ActionResult Create(users user) { if (ModelState.IsValid) { try { _userRepository.addUser(user); _userRepository.save(); return RedirectToAction("Index"); } catch { return Vie

Get Content type Id in dispform.aspx

I have added a data view web part to a DispForm.aspx of a particular list which displays the data from the child list associated to that particular list item in the parent list. In the Child data view web part I show the list of child items and a hyperlink to create a new child item.  But, the child list has 11 content types and i need to redirect to appropriate newform.aspx,how do i get the contenttypeid so that i can append to the url and redirectPlease remember to mark your question as "answered" if it solves your problem. My SharePoint Blog http://dhireny.blogspot.com
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend