views:

23

answers:

1

Hello All:

I am using DataView in SharePoint. I want to bind a collection of objects to the DataView. But when I am trying to bind it is giving the error that the collection does not implement IDataSource interface. Can anybody tell me how to extend the collection class to implement IDataSource interface?

Thanks Ashwani

A: 

An interface is a public contract- implementing an interface means that the class implements each of the methods declared in the interface. Your collection class will have to be defined as implementing IDataSource:

public class MyClass : IDataSource

and then implement each IDataSource method:

DataSourceView IDataSource.GetView(string viewName)
{
//your code here
}
...etc.

See MSDN for more details

Travis Christian
Hello Travis: thanks for ur answer. But I think u misunderstood what I wanted to ask. I know what an interface is and how to implement it. But I was specifically asking for IDataSource interface.
Ashwani K
In that case, you'll have to look up the definition of [IDataSource](http://msdn.microsoft.com/en-us/library/system.web.ui.idatasource.aspx)
Travis Christian