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

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

Adding SPListItem to a SPList with External Data Column

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :SharePoint
I used SharePoint 2010's BCS to create an external content type. I added a list column of the type "External Data" to a custom list. 1. When I add an Item through the SharePoint interface, the external data field is displayed correctly in the view. 2. I add the item using the following code:   SPListItem newItem = customList.Items.Add(); newItem["Title" ] = "Test" ; newItem["ExternalDataColumnTest" ] = "1111" ; newItem.Update();   Now, When i go to the list, i can see the new item, but the External Data Column is empty in the view. When I use the ECB action "View Item", i can see that the primary key of my external data type item was saved. When I use the ECB action "Edit Item", the external data column field is empty. When I compare the item I added with the one I added through code in the VS2010 debugger, they hold exactly the same value ("1111" in example above). Any advice would be greatly appreciated.  

View Complete Post

More Related Resource Links

Cannot delete external data list column due "Parameter name: combinedEncoded" error

Hello!   I migrated a Sharepoint 2007 to a Sharepoint 2010 by dbattach method. And now I want to delete the BDC list columns, but I'm getting this exception: System.ArgumentException:   Parameter name: combinedEncoded    at Microsoft.SharePoint.BdcClientUtil.SplitStrings(String combinedEncoded) What should I do to delete properly this columns?   Many thanks!

Adding a column from another List to a Dataview? Must I link sources or can I just add a new data so

Using Designer, I added a dataview to a webpart page and dragged in a single list source. It works as expected. I now want a column from another list in my view. Must I link in another datasource, or can i just insert the data source for the second list into my datasources? The new datasource is there in the code and I see the caml select for it. but my XSL still does not find data: <xsl:value-of select="/dsQueryResponse/Master/Rows/Row[@ID = current()/@Key]/@Lastname" /> I noticed my new columns are not in the <datafields> tag, I tried adding them but it did not help. If Master is my lookup list , @Key is the dataview I will match with and @ID is the column in Master, and @Lastname column I want to return, is the above syntax correct? Many Thanks.    

Code to import data from external db and add to SPList ONLY if it does not already exist in the SPLi


So I'm failry new at peogramming and really new at programming for SharePoint. I have created a custom timer job to run a stored procedure to import data into a custom SP List.  Got that to work fine. now I need the job to read the data in the list and if the row already exists, to scrap the incoming row. Here is a couple snippets of my code. It fails in the nested for each loop. I think I have either the CAML wrong or the loops are backwards or otherwise messed up.

    static SPListItemCollection QueryList(SPList list)

        SPQuery listQuery = new SPQuery();
        //listQuery.Query = "<Where><IsNotNull><FieldRef Name='Alert_x0020_ID' /></IsNotNull></Where><OrderBy><FieldRef Name='Alert_x0020_ID' Ascending='True' /></OrderBy>";
        listQuery.ViewFields = @"<FieldRef Name='Alert_x0020_ID' />";
        SPListItemCollection collListItems = list.GetItems(listQuery);

        return collListItems;

Adding checkbox column to data


I need to add a checkbox column to my data and do it programmatically.  I've seen a lot of other posts that address this, but can't get it to work in VB.

        Dim all3 = From p In all2
                 Let tempCost = db.maximum((p.PosVal - DollarBase) * slope + 1, 1)
                 Let Cost = String.Format("{0:$.}", Convert.ToDouble(tempCost))
                 Select p.Player, p.Team, Cost

        GridView1.DataSource = all3

        'Need to add checkbox code here


Creating an Excel Spreadsheet and Adding Data to It Programmatically

The Interoperability services make it veryeasy to work with COM Capable Applications such as Word and Excel. Thisarticle reveals using Excel from a managed application. Excel is thespreadsheet component of Microsoft Office 2000. The majority of Excelprogrammatic functionality is exposed through Automation via the typelibrary Excel9.olb. The intention of this article is to express that amanaged application can interrelate with Excel as a COM server.

Rendering data with HTML tags in the DD Gridview for a selected column


I am having trouble finding out where and how to HTML Encode a cell's data on the Dynamic Data (v4.0) gridview of List.aspx.  As a simple case, suppose I have formatted cell data that is A<br/>B in the DB.    Obviously, I want A stacked on B in the cell.

It seems gridView1.HtmlEncode = true has gone away.

So maybe I'll try to catch it on the RowDataBound event:

protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)

            if (e.Row.RowType == DataControlRowType.DataRow)
                // Html Encode the cells


but this event never fires?

Has anyone figured out how to properly render HTML tags data in the List.aspx's GridView1? 

If I figure this out, then I can add a MetaAttribute called something like [EncodeAsHtml(true)] and be on my way.  Thanks!

Data Points: Column Expressions, DataRelations, and Computations


This month John Papa fields some of his favorite questions regarding data manipulation with ADO.NET.

John Papa

MSDN Magazine January 2007

split one data column into many?


Hi, I've a database table contains survey questions and answers. But the problem is both 'question' and 'answer' are saved in the same column(like below).

SubmissionDate                                                          Submission

2010-02-15 14:53:59.657                     ***What's your pet's name?***  Lili ***Tell us about yourself*** I'm a teacher

2010-02-15 14:53:59.657                     ***What's your pet's name?***  Lucy ***Tell us about yourself*** I'm a five star cook

I'd like to use a simple datagrid to display the survey result, but I need to separate the submission column into multiple columns ('question' as column name, 'answer' as data)

the number of questions or questions being asked are different for each survey so they are not fixed. 

Is it even possible to get something like this below in a gridview? 


Business Data Column cascade


Good afternoon, I would like to know if is possible to have two business data columns linked to each other. This is the scenario that I want:

BD Column 1 called State with all US states

BD Column 2 called City with all the cities based on the state selected on BD Column 1

Use BDC data in list as multi-select column

I have a document library that uses values from another system for its metadata.  Right now, we copy the values from the primary system into SharePoint so users can choose them.  I want to find a way to use the BDC connection that I have set up to automatically pull those values.  The problem is that the current metadata is set to multi-select.  So, I have a file that is in the library and it can be used for multiple clients - clients is a column in my library and users can select many entries.  When I set up a column to pull BDC data, it only allows single entry.  Does anyone have any ideas?

BDC Entity as a Data Source for a Lookup column

Is it possible to create a custom lookup field type to have a BDC entity as the data source?

Sharepoint list group by column data ,display in webcontrol like panel or label


I  have a sharepoint list[Managers] with groupby sector column. like below




Each Sector group by column data i want to display in label or panel control.

How to do that ? how to write the logic?



Regards, Mansoor

Creating a SharePoint 2010 Web Part That Can Read and Write Data to an External Data Source

Learn to use Visual Studio 2010 to create a Visual Web Part that uses a BCS external content type in SharePoint Server 2010 to read and write data to the AdventureWorks sample database.

Sample: Creating a SharePoint 2010 Web Part That Can Read and Write Data to an External Data Source

Explore the code in this visual how-to article as you learn to use Visual Studio 2010 to create a Visual Web Part that uses a BCS external content type in SharePoint Server 2010.

Creating .NET Assemblies That Aggregate Data from Multiple External Systems for Business Connectivit

This article describes a quick, four-step process for creating a .NET assembly that BCS can use to retrieve external data for SharePoint Server 2010 by using Visual Studio 2010.

Consuming External Data Using SharePoint Server 2010 Business Connectivity Services and an Excel 201

Learn how to use BCS in SharePoint Server 2010 to access and update external data by using Microsoft Excel 2010 as a client.

Accessing BLOB Data from External Systems Using Business Connectivity Services in SharePoint Server

Learn how to use BCS in SharePoint Server 2010 to access and surface BLOB data in the SharePoint user interface and search.
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