Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1233
Best way to bind search results
posted

I have a winform that allows several different searches.  That is, based upon search options, a call to a wcf service uses a particular critieria object and returns a specific result set.  The form itself is the same for all searches. 

My challenge is configuring the ultradatasource to accept different shapes.  So, first, I created a data structure with a generic result mapping to band 0 and list properties for each different result shape as separate child bands.  I then set data binding to the parent object and the datamember pointing to the correct collection property.  This binds the data, but only for the fields that exist in both the parent and child object.  Additionally, the column headers do not reflect the child band, even though I configured the root band column headers to be invisible.

To complicate matters, I was using interfaces to present the binding shape and the PropertyDescriptorCollection to walk the chain of interfaces, which will not happen by default.  I've used this approach many times to ensure I present to the grid that which is expected, but it did not work in this case.

So, to simply matters, I bound directly to lists, removing the interfaces and property descriptors.  Unfortunately, the results did not change.

Next, I decided to set the data binding directly to the list collection and pass null as the data member.  Same results.

Finally, I added all fields to band 0, removed the child bands and used direct binding to the respective property list.  Although this works, it doesn't seem like the correct approach as it causes me to manage one big shape instead of smaller, more representative shapes.  Also, it forces me to repeat columns when the same column of data needs a different header caption. 

It seems like using a datamember should work.  Can you offer any advice on how to troubleshoot the binding?

Parents
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    I haven't had much experience with wcf, but I don't think that matters, anyway.

    I've read your description of the problem a couple of times, now, and I'm afraid I am not following you.

    Are your search results hierarchical? Or is it just a flat list of data?

    If you are binding the grid to an UltraDataSource, then it probably doesn't make sense to apply a specific DataMember, since you would end up displaying only the children of a particular parent row - whatever the current parent row in the CurrencyManager would be.

    I know that the DotNet BindingManager will not return proeprties that are exposed via an interface, it only exposes public properties. So I'm not surprised that Interfaces may be giving you trouble. But again, I'm not really clear on what you are trying to accomplish with this or even what the problem is.

     

Reply Children