-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting Active on BootstrapLink inside a Nav #416
Comments
could you please show me desired BMVC code that you'd have? |
Hey, sure! Here it goes:
By the way, the |
you could set class via
Would that solve this issue? |
No, that sets the active class on the |
Right.
... which is a bit ugly. Unless you have a different use case. |
No, the links are rendered in a for loop. But I will spare you the details of the complex pagination/UI requirements ;-) But I also ran into this when rendering a set of navigation pills to navigate to a subsection of a website. This site is powered by Umbraco, hence not within MVC controller/action context. A foreach loop that goes over the available pages in the subsection renders the pills. And offcourse, setting the I think it's comparable with how you implemented the |
This is done. Please get latest.
I didn't go with the Let me know if it worked for you. |
I understand, and I guess the BootstrapLink is also the baseclass for Link or ActionLink? |
Not quite even though it would be logical. I initially was thinking about doing that, but some complications were introduced by the fact that these helpers also needed to work under |
Haha, I had a brief look under the hood and can imagine so. Would have been nice to have a method that follows the same pattern as Disabled, but understand your point. |
First of all thanks for the wonderful work you have put into this!
I might be missing something, but I think it's not possible to set the class Active on a link inside a nav?
I was hoping that on a BootstrapLink a method
Active(bool active = true)
existed, just like the methodDisabled(bool disabled = true)
exists.I understand the methods
SetLinksActiveByController()
andSetLinksActiveByControllerAndAction()
exist on a Nav, but they can only be used if the navs are used within the context of controllers and actions.In my case, a nav is used for pagination, and it would be great if one could set Active on a BootstrapLink, just like Disabled is used.
Indended markup:
The text was updated successfully, but these errors were encountered: