Groups | Blog | Home
all groups > dotnet windows forms databinding > september 2006 >

dotnet windows forms databinding : DataGridView object within a collection from web services


Liming
9/24/2006 10:32:51 PM
Hi,

I have an object within a collection. This object has an attribute that
I need to bind to a datagridview column.

I saw this thread

http://groups.google.com/group/microsoft.public.dotnet.framework.windowsforms.databinding/browse_thread/thread/f92965be386f3a74

which described the need to modify the business classes. The problem
with mine is that I'm retriving it from a webservices. I dont' have the
luxury of modifying it.

I guess the next best thing for me is to write a converter for this
webservices and convert it using the .ToString() method described.

Are there any other methods? i could easily do this in ASP.NET using
Eval("ColumnObject.ColumnObject_Attribuet"), windows form gotta have an
easy way for it right?

Any suggestion is greatly appreicate it.
Bart Mermuys
9/25/2006 3:55:03 PM
Hi,

[quoted text, click to view]

This is a bit confusing, i guess you're talking about fields not attributes
(attributes have a different meaning in dotnet) and the link to the thread
you posted is about binding properties of subobjects, from the above i
assume that's not what you want.

[quoted text, click to view]

DataBinding only works with properties not fields, in the thread there is a
mention of FieldsToPropertiesTypeDescriptionProvider which you could use and
download from http://msdn.microsoft.com/msdnmag/issues/05/05/NETMatters/.
It doesn't require you to change the type, you can register a provider at
startup, ie: (see article too)

TypeDescriptor.AddProvider(new
FieldsToPropertiesTypeDescriptionProvider
(typeof(YourType)), typeof(YourType));

Another option is to use an object wrapper that exposes the fields as real
properties:
http://www.microsoft.com/belux/msdn/nl/community/columns/jtielens/webservicewrapper.mspx

Or another wsdl tool that can generate properties:
http://weblogs.asp.net/cweyer/archive/2003/11/21/39070.aspx


HTH,
Greetings

[quoted text, click to view]

AddThis Social Bookmark Button