asp.net mvc - Why Html.ActionLink isn't working in Bootstrap Modal? -


i've got work around own understanding i'm trying figure out why @html.actionlink wouldn't work in bootstrap modal?

i created logout controller logging , cleans session variables before redirecting. able create log out link on layout page using @html.actionlink without issue. however, have view uses bootstrap modal on it. when use same @html.actionlink doesn't work.

@html.actionlink("ok", "index", "logout", new { @class = "btn btn-success btn-lg" }) 

when @ f12 tools can see link not correct. created.

<a class="btn btn-success btn-lg" href="/?length=6">ok</a> 

however, if use @url.action in anchor tag instead works fine. works.

<a href='@url.action("index","logout")' class="btn btn-success btn-lg">ok</a> 

i'm okay using @url.action i'm trying learn why @html.actionlink wouldn't work.

you using actionlink overload wrong!

try overload.

public static mvchtmlstring actionlink(     htmlhelper htmlhelper,     string linktext,     string actionname,     string controllername,     object routevalues,     object htmlattributes ) 

the 4th parameter passing route values(querystring values) , 5th html attributes of link.

@html.actionlink("ok", "index", "logout", null, new { @class = "btn btn-success btn-lg" }) 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -