It took me quite some time to figure out how it was possible to connect my web part with a standard SharePoint list. I’ve found a lot of examples with many, many lines of code, but at the end it turned out to be very simple.
You’ll only have to add 3 extra functions to your web-part to make it work. After adding those functions you are able to connect the web part with a standard list in SharePoint. The required functions are the GetRowData & SetConnectionInterface and you will have to override the OnPreRender.
Inside the GetRowData function you can write your personal code to read out the received row. The easiest way to figure out how to access the information from the returned rowData is to debug the code and then view the contents of the rowData object. In my example it turned out that the rowData is of the type DataRowView and that the document url can be extracted from the first position in the array.
The example below shows the required GetRowData interface functions, required to retrieve a document url from a document list.
private IWebPartRow provider;
private void GetRowData(object rowData)
if (rowData != null)
System.Data.DataRowView rowInfo = (System.Data.DataRowView) rowData;
DocumentUrl = rowInfo.Row.ToString();
//Required on PreRender interface
protected override void OnPreRender(EventArgs e)
if (provider != null) provider.GetRowData(new RowCallback(GetRowData));
//Required connection interface
public void SetConnectionInterface(IWebPartRow provider)
this.provider = provider;