.NET Questions (CLOSED)

Questions and Answers on any aspect of .NET. Now closed.

This discussion group is now closed.

Have a question about .NET development? Try stackoverflow.com, a worldwide community of great developers asking and answering questions 24 hours a day.

The archives of .NET Questions contain years of Q&A. Even older .NET Questions are still online, too.

IBindable Interface?

I want a generic method that will accept a XmlNodeList and one of the repeating ASP.Net controls: DataGrid, DataList, Repeater, etc.

I thought that all of those would implement some kind of "IBindable" interface which would ensure I had "DataSource" and "DataBind" properties, however I can't find anything like this.

Thoughts on how to handle this?  In my head, it looked like this:

public void SetDataSource(IBindable Control, XmlNodeList TheData)
  Control.DataSource = TheData;

Again, in my head, this method would accept a Repeater, DataGrid,or DataList equally. Reality, sadly, has not been as kind as I hoped.

I suppose I could overload the method, but that's not nearly as cool.
Deane Send private email
Thursday, January 25, 2007
None of those classes appear to be sealed.  So you could inherit from each one, and implement your own interface in the inheriting class.  Then you use your derived classes in your project in place of the regular ones.

Granted, that seems like a bit more trouble than just overloading.

If you overload, you won't have to do an overload for each control; some of the controls have base classes like BaseDataList or BaseDataBoundControl.
Kyralessa Send private email
Thursday, January 25, 2007

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz