- Online Barcode Generator
- How To
- Buy Now
In this guiding page, we will focus on how to apply data binding for your menu, and populate corresponding menu properties to specified data source with sample codes. Examples will be provided within a Visual C# or Visual Basic .NET ASP.NET AJAX web application. So you can now download a free trial package, and create an ASP.NET project in your Visual Studio to get started!
In the following sections, we will introduce you to four types of data binding options, as well as corresponding guidance and notice. Here is a brief overview for the supported data source.
Before we get to each type of menu data binding, you might want to learn a few basic properties and methods related to data binding. Using the properties listed below, you can specify data source, and bind to menu text, value, etc.
Menu Data Binding to DataTable
Using Kettic menu UI control for ASP.NET AJAX, web developers can easily bind your menu to table-structured data sources such as DataTable. Since this data source is not hierarchical, developers can use the ID to Parent ID relationship to establish the hierarchy.
You can use the DataFieldID property to define the name of the data source field which acts as a key, and then use the DataFieldParentID property to specify the name of the data source field which acts as a key field value for parent item.
Menu Data Binding to LinqDataSource
Besides the above solution, you can also bind your menu to object-based data source such LinqDataSource. Similar to table-structured data sources, web developers can also use the ID to ParentID relationship to establish a desired hierarchy.
Menu Data Binding to SqlDataSource
Another option for your menu data binding is to bind your menu to table-based data source components, for example, SqlDataSource. You can even use it to declaratively bind your menu at design time. Since this data is table-based, you can also use the ID to ParentID relationship to establish a hierarchy programmatically.
Menu Data Binding to XMLDataSource
Some data source is by itself hierarchical, in this case, you do not need to establish it with ID to ParentID relationship. In this case, we are talking about menu data binding to XMLDataSource and XML file. When bound to hierarchical data source like this, Kettic menu will automatically create hierarchical menu items accordingly.
ASP.NET AJAX UI Controls