asp.net mvc - Why does Html.ActionLink render "?Length=4" -


I am very confused about this code

  Html.ActionLink ("About "," About "," home ", new {hidefocus =" hidefocus "})  

The result in this link:

  & lt; A hidefocus = "Hidefocus" href = "/ home / about? Length = 4" & gt; About & lt; / A & gt;  

hidefocus is the part that I wanted to achieve, but ? Length = 4 from where?

length = 4 coming from an attempt to sort string objects. Your code is turning on this code ActionLink method:

  public static string ActionLink (this HtmlHelper html helper, string link text, string action name, object path value , Object html accवटates)  

For the root value it takes a string object "home", which changes the MVC pipeline search to public properties in root values Gives In the case of a string object, the only public property is length , and since there will be no path defined with a length parameter because this property adds the name and value to the query string Parameters you will probably find that if you run this on the HomeController not on the page, it will put an error about the mistake about about the action method using the following Karan Try:

  Html.ActionLink ("about", "about", new {controller = "home"}, new {hidefocus = "hidefocus"})  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -