Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

HtmlHelpers.ActionLink should have the option to generate no content when an action does not match #1097

Closed
glennc opened this issue Sep 2, 2014 · 2 comments
Assignees
Milestone

Comments

@glennc
Copy link
Member

glennc commented Sep 2, 2014

Today some customers do it through routing and try and parse the content of the generated tag to remove the whole optional link. The alternative is to build many customized views per country, or have a separate knowledge to what actions are available.

@danroth27 danroth27 added this to the 6.0.0-rc1 milestone Sep 16, 2014
@yishaigalatzer yishaigalatzer modified the milestones: 6.0.0-rc1, 6.0.0-beta3 Jan 12, 2015
@yishaigalatzer yishaigalatzer changed the title HtmlHelpers.ActionLink should have the option to generate no content when an action dos HtmlHelpers.ActionLink should have the option to generate no content when an action does Jan 26, 2015
@yishaigalatzer yishaigalatzer changed the title HtmlHelpers.ActionLink should have the option to generate no content when an action does HtmlHelpers.ActionLink should have the option to generate no content when an action does not match Jan 26, 2015
@yishaigalatzer
Copy link
Contributor

Current behavior - we throw

@yishaigalatzer
Copy link
Contributor

For this scenario the user should use

@{
var url = Url.Action(...);

    if (url != null)
    {
        <a href="@url" />
    }
}

A user can also make custom ViewComponent or better yet a TagHelper for this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants