You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Kyle Korndoerfer <kk...@yahoo.com> on 2006/12/12 22:29:40 UTC

Complex Properties & Master/Detail Data Binding

I have a Master/Detail scenario that I am having an issue with on a web page. The *Master* DetailsView control displays perfectly by using an ObjectDataSource that returns data from the database as IList<MyClass>.

The data that I would like to display in the *Details* DetailsView control should ideally come from the Complex Property 'Contact' of the record currently displayed in the *Master* DetailsView control.

Example:

MyClass has the following properties:

    int ID;
    string XYZ;
    Person Contact;
    etc.

Person has the following properties:

    string FirstName;
    string LastName;
    etc.

MyClass.xml SqlMap (snippets):

    ...
    <resultMap ... >
        <result property="Contact" column="contactID" select="selectContact" />
    </resultMap>
    ...
    <select id="selectContact" parameterClass="int" ...>
        SELECT * FROM Contact WHERE ContactID = #value#
    </select>


The *Master* DetailsView control is showing the properties of the MyClass object(s) perfectly (Contact field is included in fields bound to the control, but hidden).

How do I get the *Details* DetailsView control to display the "MyClass.Contact" portion of the data item currently bound to the *Master* DetailsView control?

Do I have to manually bind both controls during page load & postback? There has to be an easier way and I'm sure I am missing something easy, but it is thus far eluding me.

Thanks for any help anyone can provide.


-={ Kyle }=-



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com