Htmlhelper. actionlink bug in mvctoolkit?

Source: Internet
Author: User
Tags actionlink
Paging

<%  If(Viewdata. Accounts. ispreviouspage ){ %>
<% = Html. actionlink < Speakoutfreely. controllers. managecontroller > (C => C. List (viewdata. Accounts. pageindex -   1 ), " Previous " ) %>
<% } %>

<%  If(Viewdata. Accounts. isnextpage ){ %>
<% = Html. actionlink < Speakoutfreely. controllers. managecontroller > (C => C. List (viewdata. Accounts. pageindex +   1 ), " Next " ) %>
<% } %>

The HTML generated by the next page (next) at the first point
Http: // localhost: 64701/manage/LIST/1
Next)
Generated URL
Http: // localhost: 64701/manage/LIST/1/2
It should be
Http: // localhost: 64701/manage/LIST/2!
Khan, directly the resource cannot be found...

Searched.
Http://www.getknow.taniocha.org/autor-53-1.html
[Quote]
Bug 1
If I create a controller action as follows... public void list (INT category )... and use the mvctoolkit htmlhelper. actionlink <t> as follows... <% = html. actionlink <productcontroller> (x => X. list (category), "view products for this category") %>... it generates the URL http: // server/product/LIST/1 instead of http: // server/product/LIST /? Category = 1 and when I browse to the URL it says "A value is required for parameter 'category 'In Action 'LIST'" [This is due to linkextensions. buildquerystringfromblocked expression always assuming the first parameter shocould be simply appended to the url]
Bug 2 if I create a controller action as follows... public void view (int id )... and use the mvctoolkit htmlhelper. actionlink <t> as follows... <% = html. actionlink <productcontroller> (x => X. view (productid), "view product") %>... it correctly generates the URL http: // server/product/View/1. however, when you navigate to that URL the same link now becomes http: // server/product/View/1/1. [This is because , In linkextensions. buildurl (), the call to urlhelper. action () parses the current URL and includes des any current values (like ID) if it's a call to the same action. so maybe this is a bug with the way urlhelper. action works ?? ]
[/Quote]

I can only write this... depressing...   < A Href = "/Manage/LIST/<% = viewdata. Accounts. PageIndex-1 %>" " > Previous Page </ A >
< A Href = "/Manage/LIST/<% = viewdata. Accounts. pageindex + 1%>" " > Next Page </ A >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.