C # ASP page MVC paging simultaneous dynamic generation querystring

Source: Internet
Author: User

1. Get the URL

2. Parse query string to add the key/value of the external incoming anonymous object

3. Add special Key/value to this page

4. Merge URLs

var raw = HttpContext.Current.Request.Url.AbsoluteUri; string[] Separateurl = raw. Split ('? '); /if found "?" Parse query string else return empty httpvaluecollection var queryString = Separateurl.length = = 2?    Httputility.parsequerystring (Separateurl[1]): Httputility.parsequerystring ("");  Used to add additional query string Key/value (pass anonymous object)//e.g://@Html. displayfor (x = x.paging, New//{//Additionalviewdata = new {//Model.ordersfilter, Model.searchkeyword, Model.pickupdaterange,//Model.requestdaterange, Model.deliverydaterange//}//pass in from Outsi De if (viewdata["Additionalviewdata"]! = null) {foreach (var str in viewdata["Additionalviewdata"]. GetType (). GetProperties ()) {querystring[str. Name] = (str. GetValue (viewdata["Additionalviewdata"], null)?? String. Empty).        ToString ();           }}//one more specific query strings on the This page @{querystring[xxx] = yyy; }////<a href= "@string. Format ("{0}?{ 1} ", Separateurl[0], queryString)" >something friendly</a>


C # ASP page MVC paging simultaneous dynamic generation querystring

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.