binding searchresultcollection to datarepeater

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Is it possible to bind a data repeater to a searchresultcollection, as returned from a directorysearcher

Regards

Chris
 
Hi Chris,

The Repeater ASP.NET web control's datasource can be set with any object
which implement the "System.Collections.IEnumerable " interface. Here is
the remark in MSDN:
-----------------------------------------
The DataSource can be any System.Collections.IEnumerable derived object
such as a System.Data.DataView for accessing databases, a
System.Collections.ArrayList, a System.Collections.Hashtable, or an array.
-----------------------------------------
Here is the weblink to the reference in MSDN:
#Repeater.DataSource Property
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwebuiwebcontro
lsrepeaterclassdatasourcetopic.asp?frame=true

And as for the SearchResultCollection, here is its declaration in C#:
public class SearchResultCollection : MarshalByRefObject,
ICollection, IEnumerable, IDisposable

Here is the reference in MSDN on SearchResultCollection class:
#SearchResultCollection Class
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemdirectoryservi
cessearchresultcollectionclasstopic.asp?frame=true

We can see that it has implement the IEnumerable interface, so we can use
it as datasrouce for the WEbform repeater control. But since the
SearchResult object returned from Directory Query may contain many
particular properties, so I think you'd be careful when generate the
DataBinder Expresssion in the Repeater. Good Luck:).

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
Hi Steven

Thanks for your reply

I ended up building a datatable because I had to append information from within the AD.

Regards

Chris
 
Back
Top