Object Container Data Source

Topics: Web Client Software Factory
Aug 4, 2010 at 2:04 PM


I was trying to bind DropDownList with a list of KeyValuePair<int, string> using ObjectContainerDataSource.

I was having hard times in finding out, what to put in DataObjectTypeName atribute in my .aspx file. From error messages I found out, that instead of my former

System.Collections.Generic.KeyValuePair<System.Int, Systen.String> 

I put 

System.Collections.Generic.KeyValuePair`2[[System.Int32, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

which made things work again.

Is there any easier way?



Aug 4, 2010 at 7:09 PM
Edited Aug 4, 2010 at 7:25 PM

Hi Stefan,

Based on our understanding, you attempted to use the KeyValuePair<TKey, TValue> as data type of a ObjectContainerDataSource, and found issues when using non fully qualified type names.

First of all, you could try using the following string, which should work, and it is a little shorter than the one you've mentioned:


Additionally, take into account that it is necessary to indicate a type name, composed of the namespace plus the type name. Note that the KeyValuePair must be indicated with ‘2, which helps to denote that you are using a generic type and that it expects two arguments.

Please let me know if this helps.

Fernando Antivero