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