user3383898
user3383898

Reputation: 3

How to create a dropdownlist column/field in a newform.aspx with items from another list in SharePoint?

I would like to create a column/field in a newform.aspx with items from another list in SharePoint. Basically while creating a new item in the list they should see a dropdownlist with items in columns from another list in SharePoint.

NOTE: The new item is been created in an External List, so lookup field is not an option.

List 1:

Contractor (Column)

ABC | CDE | FJG

New Form ASP.NET Code:

<SharePoint:FieldLabel Grid.Column="0" Grid.Row="4" ControlMode="New" FieldName="Contractor" />
    <Comment FieldName="Contractor" FieldInternalName="Contractor" FieldType="Text" />
    <SharePoint:FormField Grid.Column="1" Grid.Row="4" ControlMode="New" FieldName="Contractor" IncludeDescription="True"/>

Upvotes: 0

Views: 1378

Answers (2)

Aron Foster
Aron Foster

Reputation: 577

This one is relatively easy. Using SharePoint Designer, you need to insert a Data Source control for your other list, then use a SharePoint:DVDropDownList. Set the datasourceid, datatextfield, and datavaluefield to line up with your Data Source and it should plug right into your New Item Form. Note that you won't be able to do this on the newform.aspx that gets auto-created with lists and libraries; you'll need to create a different aspx page and have your users go there. That's because you have to use the "New Item Form" from the Insert ribbon of SharePoint Designer instead of the default SharePoint form for new items (which doesn't allow much customization).

Upvotes: 0

Paul Leigh
Paul Leigh

Reputation: 1231

In the primary list, create a column with a type of "Lookup", then set it to point at the other list. Standard SharePoint lookup functionality.

Upvotes: 0

Related Questions