Lookup column in sharepoint list column in visual studio

Hi i have a list with two columns as student id and student name. in second list am
taking one column as lookup and am giving reference to student name. but while inserting record in second list when am selecting student name and clicked save ,in second list i have to save student id not student name. (just like dropdown in asp.net data text
field and data value field.) how can i achive this in sharepoint using lookup column and am creating the second list in visual studio.

you need to create a  look up column on Name field in second list and a second look up column on the same field.
then hide and show your fields in edit and display form based on your requirements .
<Field
ID="{886AF390-F68A-4B8A-9EC4-12108A11CC99}"
Name="StudentName"
DisplayName="StudentName"
Type="Lookup"
List="Lists/Students"
ShowField="StudentName"
PrependId="TRUE"
Group="test">
</Field>
<Field
ID="{599F97C5-564C-4DE5-BE4D-3A49DDC87FB5}"
FieldRef="{886AF390-F68A-4B8A-9EC4-12108A11CC99}"
Name="StudentId"
DisplayName="StudentName:Trainer StudentId"
Type="Lookup"
Required="FALSE"
ShowField="StudentId"
List="Lists/Students"
Group="test">
</Field>

Similar Messages

  • Group by on more than 2 columns in SharePoint List

    Hi,
    Is there any way to use Group-by on more than 2 columns? I know there is a way using SPD which I have implemented as well, however it makes the page READ-ONLY. 
    Any other way? May be using custom code?

    Try this
    http://chanakyajayabalan.wordpress.com/2010/03/15/group-by-for-more-than-two-columns-in-sharepoint-list/
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/05fbde73-efdb-40dc-a206-55d56caa21d4/make-group-by-for-3-or-more-then-3-columns-in-sharepoint-2010-list?forum=sharepointdevelopmentprevious
    http://techtrainingnotes.blogspot.in/2011/01/sharepoint-group-by-on-more-than-2.html

  • WebPart average of a SharePoint list column

    Hello;
    I need a Web Part that displays the average of a SharePoint list columns
    thank you

    Open the AllItems.aspx page of that list in SharePoint Designer
    Select a title and right click on it. Format item As -> Hyperlink to -> Edit Form
    This will redirect you to edit form when the title column link is clicked.
    But if you want to show the modal pop up it edit mode, open the Allitems.aspx page in designer
    Select the list view web part, on the ribbon in the List View Tools -> Design tab -> Customize XSLT -> Customize Entire View
    Switch to the code view, search for FORM_DISPLAY and change it to FORM_EDIT.
    jayant prabhakar

  • Open Hyperlink column in sharepoint list in Modal dialog box without redirecting to any page.

    Please help me to achieve:
    open Hyperlink column in SharePoint list in Modal dialog box without redirecting to any page.

    You can use the JSLink to achieve it:
    link
    [custom.development]

  • Can't create a Content Type List Item on Visual Studio 2010

    Can't create a Content
    Type List Item on Visual Studio 2010

    Hi,
    According to your description, my understanding is that you want to select the specific content type in new item form.
    This is a default behavior. The "Add new item" link uses the default content type and does not display a dropdown list to change that value. This behavior is hard coded into the control and can't be changed.
    Here are some similar threads for your reference:
    https://social.technet.microsoft.com/Forums/en-US/de60f2a1-df91-4a67-a606-02a593c977b4/choose-a-content-type-when-creating-a-new-list-item?forum=sharepointcustomizationlegacy
    http://sharepoint.stackexchange.com/questions/13281/content-type-field-missing-from-new-form
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • Deploing a BDC Model project to SharePoint Foundation 2010 usinging Visual Studio 2010

    Hello,
    I am tring to deploy external content type to Sharepoint 2010 foundation using Visual studio 2010 and I followed this:
    http://blogs.msdn.com/b/vssharepointtoolsblog/archive/2010/04/02/deploy-a-bdc-model-project-to-sharepoint-foundation-2010-using-visual-studio-2010.aspx
    after completing procedure I have tried do deploy solution but I always get this exception:
     Error 1 Error occurred in deployment step 'Add Solution': Access denied by Business Data Connectivity.
        Error was encountered at or just before Line: '0' and Position: '0'.
      0 0 BdcModelProjectTest
    I have tried to grant myself permissions in Sharepoint central administration (
    http://blogs.msdn.com/b/ericwhite/archive/2010/06/11/access-denied-by-business-data-connectivity.aspx ) but when I click ok I get this exception
    No windows identity for damain\username. 0a193cf4-3811-4aa8-a657-0de3b8be3793
    07/04/2011 16:46:46.31  w3wp.exe (0x0828)                        0x1414 Business Connectivity Services Business Data                
     g0k9 High     Access Denied for User '0#.w|damain\username, which may be an impersonation by damain\username
    I am really hopeless, can anyone help?

    Hi,
    It seems that an account are you using to deploy solution doesn't have sufficient permission in the BDC Metadata Store. In order to assign permission you should open Central Administration->Application Management->Manage Service Application->Business
    Data Connectivity Service->Click Set Metada Store Permission on the ribbon->Set Permission you need and tick the checkbox "Propagate permission to all..."
    Dmitry
    Lightning
    Tools Check out our SharePoint tools and web parts

  • Question about creating association between Sharepoint BDC entities using Visual Studio 2010

    I am following this tutorial:
    http://blogs.msdn.com/b/vssharepointtoolsblog/archive/2010/08/02/walkthrough-of-creating-association-between-sharepoint-bdc-entities-using-visual-studio-2010.aspx
    I am getting the following error:
     There is an error in the TypeDescriptors of Parameters on Method with Name 'CustomerToOrder' on Entity (External Content Type) with Name 'Customer' in Namespace 'BdcAssociationSample.BdcModel1'. The TypeDescriptors incompletely define where the Foreign
    Identifiers of Entity 'Order' in Namespace 'BdcAssociationSample.BdcModel1' are to be read. That Entity expects exactly '1' Identifiers, but only '0' TypeDescriptors with the correct Association were found from which to read them.
    I have viewed the following:
    http://lightningtools.com/business_connectivity_services/the-typedescriptors-incompletely-define-where-the-identifiers-of-entity-x-are-to-be-readbcs-error/
    after reading that article, I am still not sure what setting I am missing.  Does anyone have the full working source code from the msdn article linked above?

    Hi,
    According to your post, my understanding is that you got the symbols not loaded error.
    First try rebuilding your project by right mouse click the project > Rebuild If that doesn't work, try a clean of the project (right mouse click on the project > clean)
    If that didn't work check this:
    Right mouse click your project
    select [Properties]
    select the [Build] tab
    make sure [Define DEBUG constant] and [Define TRACE constant] are checked
    Click the [Advanced] button at the bottom of the Build tabpage
    Make sure that [Debug Info:] is set to [full]
    Click [OK] and rebuild the project ;
    Hope that works for you! (step 6 generates the .pdb files, these are the debugging symbols)
    What’s more, you can clean & re-compile the code, then install the respective dlls one more time to GAC (just remove them before adding to GAC again), do an IISReset to check whether it works.
    More reference:
    http://stackoverflow.com/questions/2155930/fixing-the-breakpoint-will-not-currently-be-hit-no-symbols-have-been-loaded-fo
    http://stackoverflow.com/questions/2301216/the-breakpoint-will-not-currently-be-hit-no-symbols-have-been-loaded-for-this-d
    http://geekswithblogs.net/dbutscher/archive/2007/06/26/113472.aspx
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • How create custom sharepoint 2013 theme in Visual Studio

    Please advice! I created a custom theme for sharepoint 2013 with fonts, colors and masterpage. Using Design Manager i created a wsp file for this theme. After this i could upload this file to any site and choose my theme. As i understood, Design Manager
    take all files from site (all masterpages, colors and etc), not only my files.
    Now i want to understand how i can create a custom theme in visual studio. I want include in my wsp files only files which i need and may be make a feature, which will be activate my custom theme. 
    Please give any useful recouses which can help to understand how make it right :). Thanks a lot!
    from MSDN forum...

    Hi Evgeny,
    check the following for how to do that
    http://weblogs.asp.net/sreejukg/customize-sharepoint-2013-look-and-feel-for-intranet-sites
    http://weblogs.asp.net/sreejukg/apply-custom-theme-to-sharepoint-2013-mysite-using-feature-stapling
    http://www.sharepointeurope.com/blog/2013/5/3/creating-sharepoint-2013-themes,-first-look,-gotchas,-provisioning-with-visual-studio-2012
    http://yuriburger.net/2013/03/24/deploying-and-activating-sharepoint-2013-themes-using-visual-studio/
    Kind Regards,
    John Naguib
    Senior Consultant
    John Naguib Blog
    John Naguib Twitter
    Please remember to mark this as answered if it helped you

  • Has any one worked on sharepoint 2013 workflows using visual studio.

    Has any one worked with sharepoint 3013 workflows using visual studio.

    Hi,
    To develop SharePoint 2013 workflow using Visual Studio, you can refer to:
    Develop SharePoint 2013 workflows using Visual Studio
    Create a SharePoint workflow app using Visual Studio 2012
    Get started with workflows in SharePoint 2013
    Thanks,
    Linda Li                
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • Beginning SharePoint 2010 Development with Visual Studio 2010

    I am a beginner with SharePoint 2010 development with Visual studio 2010. Please guide me for some good, practical videos tutorials and books which would help me get started with programming. I need to build some workflow in VS2010 in C#. Please help!

    Hi PinkRuby, 
    There are some good videos on the MSDN site that give a general overview of developing on the SharePoint platform. 
    http://msdn.microsoft.com/en-au/office/dn448488
    Another good resource is PluralSight. You need a paid subscription (though it's not much), but it has lot's of great video content for learning. 
    http://pluralsight.com/training/Courses#sharepoint
    Regards, Matthew
    MCPD | MCITP
    My Blog
    View
    Matthew Yarlett's profile
    See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
    Upload and Crop User Profile Photos

  • Create SharePoint 2013 workflow using visual studio 2013

    Dear Team,
    How  to create a workflow for template approval process using visual studio 2013.To achieve this do i need to install share point on my machine.

    Hi,
    According to your post, my understanding is that you want to create a SharePoint 2013 workflow using Visual Studio 2013.
    We need setting up and configuring Microsoft SharePoint Server 2013 and the Workflow Manager Client 1.0 server, see Start:
    Set up and configure SharePoint 2013 Workflow Manager.
    The following materials for your reference:
    Develop SharePoint 2013 workflows using Visual Studio
    http://msdn.microsoft.com/en-us/library/office/jj163199(v=office.15).aspx
    How to: Create SharePoint 2013 Workflows using Visual Studio
    http://msdn.microsoft.com/en-us/library/office/dn584771(v=office.15).aspx
    Developing SharePoint 2013 workflows with Visual Studio demo
    http://www.bing.com/videos/watch/video/developing-sharepoint-2013-workflows-with-visual-studio-demo/10t0er5gh
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Using Sharepoint List Columns to create a simple trend chart

    Hello,
    I am trying to use a single sharepoint list fields with as my data to create a chart.
    I have only two columns I want to create the chart with: The date and time picker
    column where the user picked a date and time and it is formatted accordingly and the Item ID.
    I just want show how many items were created in each month and year. For e.g if there were 3 items created in between Jan 1st- 31st, 2014 then I want it to show a count of 3 for the month of Jan.
    I used the MonthName and string conversion for the X axis and it seems to be showing the month and year, but I cannot get the items that were created to show up for each month.
    Any guidance is welcome!
    I would like to create a trend chart that shows how many

    Hi PinkPowerRanger,
    Per my understanding that you have two fields in the table "Date and Time picker" which is Date/time type and another is "Item ID", you need to get the Month from the Date field to display in the X-axis and count(Item ID) related to each
    month to display in the Y-Axis, right?
    I have tested on my local environment and can do this by create two calculated fields to get the month and year values from the Date/Time field.
    Details information below for your reference:
    Right click the main dataset to select the "Add Calculated field", specify an name of the new calculated field and add the expression in the field source as below:
    Year:    =Year(Fields!Date.Value)
    Month:  =MonthName(Month(Fields!Date.Value))
    Add the three field in the Chart as below and remember in the Value area you have got the Count(ItemID) but not SUM(ItemID):
    Preview you will got the chart like below:
    If you still have any problem, please feel free to ask.
    Regards
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • How to update SharePoint list columns including choice fields programmatically?

    Hi All,
    I have a requirement to update multiple columns (which are choice columns) in a SharePoint list.  I'm a newbie at creating event receivers and timer jobs.  Not sure which one to do and where to start first.  There are approximately 4500
    list items in the lists.  I was thinking I could use one list to maintain the Keywords and perform updates or timer job to any targeted lists. 
    Scenario.  Anytime a power user of the sharepoint list wants to update any of the choice field items or possibly even the column name itself, they want to be able to make updates to any of the list
    items or other
    lists that contain the new name.  The columns I'm using are all choice fields named Assigned To, Division, Region, Job Title, Department, and Zone.
    Here's sample code for Updating list:
     using     (SPSite oSPsite = new SPSite("team url/"))   
     using     (SPWeb oSPWeb = oSPsite.OpenWeb())         
     oSPWeb.AllowUnsafeUpdates =   true;          
     // get the List                
     SPList list = oSPWeb.Lists["Keywords"];        
     //Add a new item in the List                
     SPListItem itemToAdd = list.Items.Add();               
     itemToAdd["Title"] = "My Title Field";               
     itemToAdd["Assigned To"] = "Assigned To";               
     itemToAdd.Update();          
     // Get the Item ID               
     listItemId = itemToAdd.ID;          
     // Update the List item by ID                
     SPListItem itemToUpdate = list.GetItemById(listItemId);               
     itemToUpdate["Assigned To"] = "Assigned To Updated";               
     itemToUpdate.Update();          
     // Delete List item                
     SPListItem itemToDelete = list.GetItemById(listItemId);               
     itemToDelete.Delete();                   
     oSPWeb.AllowUnsafeUpdates =   false;         
    Any help is greatly appreciated.  Please provide code sample and references.  Thanks!

    Thanks Ramakrishna -- Here's what I have so far.
    namespace MonitorChanges
            class MyTimerJob : SPJobDefinition
                public MyTimerJob()
                    : base()
                public MyTimerJob(string sJobName, SPService service, SPServer server, SPJobLockType targetType)
                    : base(sJobName, service, server, targetType)
                public MyTimerJob(string sJobName, SPWebApplication webApplication)
                    : base(sJobName, webApplication, null, SPJobLockType.ContentDatabase)
                    this.Title = "My Custom Timer Job";
                public override void Execute(Guid contentDbId)
                    // Get the current site collection's content database           
                    SPWebApplication webApplication = this.Parent as SPWebApplication;
                    SPContentDatabase contentDb = webApplication.ContentDatabases[contentDbId];
                    // Get a reference to the "ListTimerJob" list in the RootWeb of the first site collection in the content database           
                    SPList Listjob = contentDb.Sites[0].RootWeb.Lists["ListTimerJob"];
                    // Add a new list Item           
                    SPListItem newList = Listjob.Items.Add();
                    newList["Title"] = DateTime.Now.ToString();
                    newList.Update();
    Talibah C

  • How to have repeating columns for SharePoint list

    Hi
    I am working on SharePoint 2013 environment and trying to customize a SharePoint list using infopath form.
    Have a list called "Future Actions" and users need to submit their actions. An user can submit
    n number of Planned actions and every user will submit different number of actions.
    Columns:
    1. Title                                   TEXT
    2. Month                                 Choice
    3. Planned Actions                   TEXT
    I want to capture user's actions in the same form, such that he would have option to expand the
    Planned actions column to add n number of Actions.
    Simply, For one Month, user should be able to define all actions in one form. and the number of planned actions will vary from user to user.
    Pls suggest

    Hi,
    The OOTB can't provide a feature to meet your requirement.
    Here is a similar thread for your reference:
    http://social.msdn.microsoft.com/Forums/en-US/e475cc7f-435f-4e6e-b579-c74311d67b4e/creating-repeating-columns-in-sharepoint-2010-list
    In SharePoint 2013, we can also customize a special field type using client-side rendering.
    http://msdn.microsoft.com/en-us/library/office/jj220061(v=office.15).aspx
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How can I add new user in sharepoint list column (people or group) or in sharepoint group using loginName only

    Hi
    If I have only login name of any user like - "Donamin\login_name".
    If this user is not present in sharepoint portal.
    How can I add this user to people or group column of any list or in any  sharepoint group with permission?

    hi
    got the issue
    it should be  like this -
    string userloginname = @"DOMAIN001\vyankatesh_mujumdar"
    using (SPSite oSpSite = new SPSite(site.ID))
    using (SPWeb web = site.OpenWeb())
    try
    { SPList lst = web.Lists["TestList"];
    string userloginname = @"DOMAIN001\vyankatesh_mujumdar";
    web.EnsureUser(userloginname);
    SPUser oSPUser = web.SiteUsers[userloginname];
    SPFieldUserValue FieldValueName = new SPFieldUserValue(web, oSPUser.ID, oSPUser.LoginName);
    SPListItem oSPListItem = lst.Items.Add();
    oSPListItem["Title"] = userloginname;
    oSPListItem["People"] = FieldValueName;
    oSPListItem.Update();
    catch (Exception ex)
    ExceptionManager.LogErrorInFile("--------Exception -------", bIsLogEnabled);
    ExceptionManager.LogErrorInFile(ex.Message, bIsLogEnabled);
    ExceptionManager.LogErrorInFile(ex.Source, bIsLogEnabled);
    ExceptionManager.LogErrorInFile(ex.StackTrace, bIsLogEnabled);
    ExceptionManager.LogErrorInFile("-------------------------------------------------------", bIsLogEnabled);
    Thanks for all for the reply

Maybe you are looking for

  • Can 2 diff itunes in one household have one central music location?

    Hi everyone, my husband and I each have iTunes on their (Win based) computers. (it syncs with our phones, outlook, etc). currently, our music library is divided between the two computers - which is not ideal... i was hoping to move all the music to o

  • Passing arguments to java methods

    i Haver been reading the java web page on this, yet am still miffed about what happening. heres the code    class A {         public int x;         A(int x) {             this.x = x;         public String toString() {             return Integer.toStr

  • Can't update adobe flash player

    I keep getting told there is an update available but when I try to run it all I get is a black box and nothing installs

  • Install Acrobat 7.0 professional on Mac (OS10.5.8)

    I load the disc to my apps folder, and try to start it, but it keeps crashing. Any thoughts? Thanks

  • Calling SAP Script Editor from Report

    Hi, Can any one solve this Problem. How to call SAPscript  Editor i.e. MS word editor (where we are giving Text elements or Text variables or Text. I want to call the above text editor from my report. Can any one give answer for this. Thanks & Regard