Hi Joel,
When mapping Database content to menu properties during databinding you have to follow the same principle as with XML content files - you have elements representing the required objects (Menu, Group, Item) and attributes representing object properties like Text, Href, Target, etc. So the mapping goes one-to-one: the attributes in the XML files have the same signature/definition as the properties in the API.
This rule applies to the databinding as well: the mapping is one-to-one, which means that you have to provide a DataSource and DataSet (containing the bind table) or DataTable that have columns, named in the same way the as properties. This could be accomplished in two ways:
- You can set the column names directly in the underlying DB storage
- The user has a DB with tables that have their names already set. The Description column corresponds to the MenuItem's Textproperty, col1 column corresponds to MenuItem's Href property, etc. When this is the case, we have to alias the generic DB columns so that the databinding process could automatically accomplish its task (generating the menu structure). This could be done easily by using SQL Aliasing in the SELECT statement (in the SQL query or stored procedure), so that the generic column names could be resolved to the property names.
Example: SELECT ITEMID, PARENTID, DESCRIPTION AS Text, col1 AS Href FROM MyTable WHERE ….
For more details please review the Help Manual (look for Mapping DB Content to Menu Properties) as it contains all the essential information that handles the matter.
Regards,
the telerik team