.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

Lookup field with drop downs

Posted By:      Posted Date: September 14, 2010    Points: 0   Category :SharePoint
Hi, I have created a lookup called projectname in a list called status. This projectname selects it's value from the project list. There are 2 fields on this list that are drop down list of values that I want to appear in the status list as lookups based on the projectname. However any special field types such as person or drop down list don't seem to appear, it looks like you can only show the related text fields? Is there anyway around this? Many Thanks, Michael  

View Complete Post

More Related Resource Links

FormView Text Field Being Set by A Drop Down List


Hello, I have a FormView which is used to insert a record into a database.  Outside of this formview i have a drop down list, I want to grab the value from that drop down list and set one of the text fields within the formview to it's currently selected value.  I've tried the following code, but the dynamic categorytextbox line is what seems to not be working.

                    <asp:DropDownList ID="ddlCategory" runat="server" AutoPostBack="True" 
DataSourceID="SqlDataSourceCategory" DataTextField="CategoryName"
DataValueField="CategoryID" Width="200px">

                            <asp:TextBox ID="CategoryIDTextBox" runat="server" 
Text='<%# Bind("CategoryID") %>' Visible="False" />

        protected void FormView1_DataBound(object sender, EventArgs e)
dynamic varCategory = ddlCategory.SelectedValue;
dynamic categoryTextBox = FormView1.FindControl("CategoryIDText

Creating a custom drop down field type with SelectedIndexChanged Event

Hi All, I am trying to create a custom drop down field type and I was able to acheive that using the MS link http://msdn.microsoft.com/en-us/library/bb861799.aspx. As per the link, once the custom field is created we can override the "Validate" method to write the Validation logic and that works fine for me too. However I am facing a challenge even before going to Validate . Let me explain my actual requirements here. I need to build a custom drop down field and expose the field to the user in "Edit Properties " Page of a document library. Along with this field, I will be having some OOB site columns in the Edit Properties Page (Ex: Title, Subject etc)  . When user selects a value in the drop down, I need to hide/show few OOB site columns based on certain criteria.  I am facing a challenge of how to capture the "SelectedIndexChanged " event for the Custom drop down field in Sharepoint (Can we wire the SelectedIndexChanged event to a custom dropdown field type) ? Is this acheivable in SP 2010 Custom field type ? If so, how can I do it ? Can any of you kindly help me here?   Regards, Yesh

Filter 2 drop downs

Using SP2010 and InfoPath 2010. I have 2 drop downs in a form. One is called "Offices" the other "Devices". What I want to do is upon selection of an office is list devices in the "Devices" drop down that belong to that office. I started to create a seperate list of all the devices then a second column label office. Am I on the right track? Please help thanks.

Value changing to integer value when changing top drop down box from cascaded drop downs in Sharepoi

Hi, I have two drop down boxes named Categories and Sub Categories. When I select a category, the sub category populates fine and I can select the values where the category is equal to the category lookup field. But as soon as I then change the Category field again once I have selected both the category and sub category fields, the sub category field changes to an integer value? How can I change this so it just selects the blank value again?

How do you update a Lookup Field from CAML by Name rather than ID

Hi, I have the following batch update in my code: xml += "<Method ID='" + currentID + "' Cmd='Update'>"; xml +=   "<Field Name='ID'>" + ID + "</Field>"; xml +=   "<Field Name='FileRef'>" + fileRef + "</Field>"; xml +=   "<Field Name='Title'>" + doc.NewFileName + "</Field>"; xml += "<Field Name='Keywords'>" + doc.Keywords + "</Field>"; xml +=   "<Field Name='Select_x0020_Type'>" + ((doc.TypeName == "General") ? 1 : 2) + "</Field>"; xml +=   "<Field Name='Population'>" + "Demography" + "</Field>"; xml += "</Method>"; The Population field is a lookup. It works if I put the ID of the ListItem in there, but not if I put the name - I need to put the name in. Can anyone help? Thanks. John.  

DataView WebPart with lookup and person field

Hi I want to insert a dataview webpart, using REST, referring to a list with look-up fields and people fields. The results I receive are the ID's instead of the values. How can I get back the corresponding values? TIA Sjokke

WSS Lists - Lookup field information missing in Excel 2010

Hi, I've got this xls workbook which contains a two-way synchronized SharePoint list. This WSS list contains columns which are related to other lists: for instance the list we're using is a list of assignments, where an assignment is related to an accounting period. Our server also has another list with all accounting periods. Both lists are related since the assignment list as an accounting period column of lookup type which uses the accounting period list as a source. In previous versions of Excel, the output is that the accounting period field is a combobox populated with all availalble accounting periods. Thanks to that, the user can easily link an assignment to an accounting period by selecting a value in this combobox and synchronizing. This works great with Excel 2003 and 2007, however in 2010 (same workbook, consuming the same lists) related information doesn't appear. The combobox is empty and as a consequence the user gets a data validation error since the value in the cell isn't among available values. Is there something special I should do to enable this feature in Excel 2010? Regards, Carl 

SharePoint Designer 2007 Workflow needs to initialize lookup field value and store it

This is for a governance tracking list. I have two tables: Roadmap and Roadmap Status In Roadmap, there are two fields of interest that are lookup fields to Roadmap Status:Title they are Status and OldStatus When an item is entered in Roadmap, I want to force the initial Status to "Submit" from Roadmap Status. I don't see any way in my workflow to to lookup that item in Roadmap Status and place the pointer (I'm assuming it is a GUID) into the field. The value is also stored in OldStatus to catch changes as I'm trying to force order of status in a few cases but not all. I'm doing it with a Lookup instead of Choice because the business tends to change the terminology they like and this way I don't change it in several places plus it allows them to change it in the list instead of someone changing the list field values. I've seen several places on the forum where people have a similar problem and Lambert Qin has given an answer but it never fits this scenario exactly. Do I have to go back to Choice columns? I only have Designer and would rather not have to learn another tool for a simple SharePoint implementation. Thanks for any help!

Display each new line of a sharepoint mutliline text field as choice in drop down box.

The question pretty much says it all. I have a lot of data I need to represent, and this would be the best way to do it. I have a multiline text field in sharepoint, where each line has a choice that should be a seperate choice in a text box. How do I do this? I have the data connection set up, and I would be fine with adding some sort of tag after each line, if that would make it so infopath can somehow parse out those tags, and interpret each "chunk" as a choice. Thanks in advance for your help.

User Specific Values for a Drop Down "Choice" Field

I would like to create a drop down field which has some fields disabled or not visible based on the user logged in.  Is this possible?

Lookup field issue after restore

After restoring a site collection in MOSS 2007, lookup fields cannot link up with the parent list. May I know if this problem fixed in MOSS 2010? Besides, the list item GUID in MOSS 2007 are changed after restoring. Does this case still appear in MOSS 2010? Thanks!

Issue Adding a new Lookup Field to an existing List Instance

I have a code base that houses all of the column, content types, template, and list instance definitions. Am using the Update functionlaity a lot from version to version. Has been working well to this point. I just added two new columns (fields), one a Lookup and the other a Multi-Lookup. The fields are added fine on the update, columns look correct and the content type to which these were added also look fine. I can create a new List instance from the content type, and the new lookup columns are fine. The problem is this. Any existing list instances that were created from this same content type, now blow up when I try and access list items via the SP GUI. Something about a valid GUID, I dont't have the exect error anymore, but will repost it when I recreate the issue for the tenth time. I tried deleting the new lookup fields from this new list instance, thinking that I might be able to re-add them to fix the problem, but I get a new stack trace when I try and re-add them. Any hints on where I can start digging would be appreciated. I think I'll start with comparing the list instance schemas between an existing list and a newly created one.  

Creating a generic template writer that can handle drop downs and option lists


If I have a the following model

public class User
		public List<Company> Companies;
		public string Login { get; set; }

		[DisplayName("First Name")]
		public string FirstName { get; set; }

		[DisplayName("Last Name")]
		public string LastName { get; set; }

		public string Password { get; set; }

		private int Company { get; set; }

And the following generic control template writer (which would have to be extended appropriately)

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<% foreach (var prop in ViewData.ModelMetadata.Properties .Where(pm => pm.ShowForEdit && !ViewData.TemplateInfo.Visited(pm))) 
{ %>
	<div class="SD_FieldItem">
		<% if (!String.IsNullOrEmpty(Html.Label(prop.PropertyName).ToHtmlString()))
			switch (prop.ModelType.Name)
				case "Boolean":

						<div class="SD_BoolField">
							<%= Html.CheckBox(prop.PropertyName) %>
							<%= Html.Label(prop.PropertyName) %>
							<%= Html.ValidationMessage(prop.PropertyName, 

lookup field list instance



Got and problem with and lookupfield I create some list instances, list definitions, content types with a lookupfields and all works fine  the list resovels the good list source guid so I can selected te values but when I try to save I get;

<nativehr>0x80070057</nativehr><nativestack></nativestack>Invalid data has been used to update the list item. The field you are trying to update may be read only.

When I manualy create a new list instance from the list definition everything works fine.
I'm guessing that the create list instances in the feature is causing the problem?

What am I doing wrong?


Rules on Drop Down List to populate another text field


I have a last name field in infopath 2007 web form with a drop down on sharepoint list. When they select a certain last name, I want it to populate the primary dept field on form. I set up a rule on the last name to set the primary dept field = to the primary dept field on datasource when the last name field is not blank. What I am getting is the primary dept value for the first record in the datasource. I am trying to understand what record I have. Do I need to do another query back to the datasource with the last name field to have the correct entries available to populate the dept field with? Please give me some clue. I am a programmer but not grasping the interplay between the datasource and the form and noit finding what I need in numerous google searches.



update a lookup field from different site


class FeatureReceiver:SPFeatureReceiver


public override void FeatureActivated(SPFeatureReceiverProperties properties)


SPList _SPList = (SPList)properties.Feature.Web.Lists["DestinationList"];

_SPList.ParentWeb.AllowUnsafeUpdates = true;

 using (SPSite oSiteCollection = SPContext.Current.Site) // or give a destination site collection here...
                     using (SPWeb oWebsiteRoot = oSiteCollection.OpenWeb("/sites/Source1/Source11"))
                        SPList oList = oWebsiteRoot.Lists["SourceProjectList"];

Required Field Validator and drop down list


 I am trying to get the required field validator to work. I have given it an initial value of the first index value in the dropdown list. I is just not working. Will my contrrols residing on a View of a Multiview control effect anything. I am using all drop down lists?

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