Bài đăng
Add a column with a default value
- Nhận đường liên kết
- Ứng dụng khác
Active links on Bootstrap Navbar with ASP.NET MVC nguồn http://saasthara.com/
- Nhận đường liên kết
- Ứng dụng khác
If you have used Bootstrap with your ASP.NET MVC application, you might have faced some issues with implementing active links of it’s Navbar component. We’ll have to dynamically add a css class called active to the particular menu item in order to make it selected in the Navbar . After spending some time i have come up with a HtmlHelper extension which is capable of rendering menu items as well as drop-down menu items. I’ve used ASP.NET MVC 4 with Razor and Bootstrap 3 . Hope this would help you First step is to create a HtmlHelper extension class. I’ve created a folder called Helper in my project root and added a class file named MenuItem.cs . Put the following content into MenuItem.cs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 namespace