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
2745
igCombo Complex Object for DataSource
posted

I have am using cascading combo boxes but instead of getting the value from the server, I want to filter the existing data sources locally.  This is because the query is slow and when the page loads, I have all the data locally.  The model I have bound currently has two properties.  The Text/Value field and an ID.  The ID tells me the parent so I can map it back.

Location Model:

    [LocationName]
    [LocationId]

Parent Combo Box:

    [Text]:     LocationName
    [Value]:   LocationId

Item Model:

    [ItemName]
    [LocationId]

Combo Box:

    [Text/Value]:   Item.ItemName

In the datasource, how do I get the Location Id?  It only gives me the name.  I think I need to create the data source separately from the control then bind it manually but I don't see an easy way to do this in Razor.  Thoughts?

Parents Reply Children
No Data