Part 155 Binding asp net menu control to an xml file using xmldatasource control

  • دعنا نشارك هذا :
ترتيب الدرس : 155
المدة : 00:10:20
التحكم :
Text version of the video

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.


All ASP .NET Text Articles

All ASP .NET Slides

ASP.NET Playlist

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

In this video, we will discuss binding menu control to an xml file using xmldatasource control. This is continuation to Part 154, please watch Part 154 before proceeding.

1. Add an XML file and name it MenuData.xml. Include the menu item xml.

2. Drag and drop an XmlDataSource control on the webform. Set XPath and DataFile attributes. Notice that DataFile attribute points to the XML file that we added in Step 1.

3. Drag and drop a menu control and set DataSourceID attribute to the xmldatasource control we created in step 2. Also, set DataBindings.

4. To set the styles for the selected menu item, copy and paste the following code in the code-behind file.
private void Check(MenuItem item)
if (item.NavigateUrl.Equals(Request.AppRelativeCurrentExecutionFilePath,
else if (item.ChildItems.Count ] 0)
foreach (MenuItem menuItem in item.ChildItems)

protected void Menu1_PreRender(object sender, EventArgs e)
foreach (MenuItem item in Menu1.Items)

سيتم تفعيل التعليقات قريبا

Sep 23, 2020 07:32:27