populate bootstrap navbar in asp.net website from database

user2489259

Can any one give me an example on how to build a bootstrap navbar within an asp.net website dynamically from database according to the role of the logged user (sth like populating asp menu) and keeping the same style of the navbar. any help will be very appreciated as i have searched too much and i can't find a solution.

ewitkows

The nav bar in twitter bootstrap is essentially just an unordered list. So make the code as neat or as messy as you prefer, but create a div with an id and a runat="server", and reference that in your code behind. For example, your markup could read:

<div id="myNav" runat="server"/>

In your code behind, read your data items from the database, generate the appropriate HTML, and write it to the DIV. One such example:

Dim sb as New Stringbuilder()
sb.append("<ul>")
sb.append("<li>Item 1</li>")
sb.append("<li>Item 2</li>")
sb.append("</ul>")
myNav.InnerHTML = sb.ToString()

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

populate radiobuttonlist from database table in asp.net mvc

Bootstrap slider in ASP.NET MVC from SQL Server database

Navbar fits to screen even after using .container class from bootstrap in Asp.Net MVC 5

Asp.Net MVC Code First : Populate drop down options from different database

Populate multiple Textbox from Database by select Dropdown list ASP.NET Core MVC

What is the way to populate a dropdownlist from a database in asp.net by using classes?

How to populate google charts using data from database created via code first - ASP.Net MVC

Populate DropDownList in ASP.NET MVC from database table using Entity Framework 6 and ViewModel

Populate dropdown from database when onchange event is triggered ASP.NET MVC5

Populate asp.net treeview from clientside

Default navbar from bootstrap's website not looking the same

(asp.net) Bootstrap 4 Navbar toggler not working

ASP.NET WebForms and Bootstrap 4.1.3 Navbar not working

Publish asp.net Website from CommandLine

how to select from database and populate in a text box on Vb. net

How to populate treeview control with data from database vb.net

Populate Dropdownlist from Model in ASP.NET MVC

Populate combobox in ASP.NET MVC with data from a WCF service

ASP.NET : populate many label from one SQL command

Fixed a navbar from bootstrap

How to resize dynamic images coming from database in a responsive bootstrap website

Bootstrap fixed to top navbar covering website

How to disable Horizontal scroll on a website NavBar with Bootstrap

ASP.NET Comparing data from Database

Show Images from Database ASP.Net

Get id from database (ASP.NET)

MenuControl in asp.net from database

Default path of database in a bootstrap website?

How to automate "run asp.net website" from command line?

TOP Ranking

HotTag

Archive