简体   繁体   中英

Response.Redirect with querystring

This is a simple question but I was wondering how to do this. I have a gridview that has a list of customers and in the gridview there is a linkbutton as a template field that says view cart. In the onclick method I have

Response.Redirect("~/Cart.aspx?ID=" + Request.QueryString["ID"]);

On the cart aspx page I have another gridview that I want it to display just the items in that customers specific cart. This gridview has a querystring parameter

            <SelectParameters>
            <asp:QueryStringParameter Name="ID" QueryStringField="ID" Type="String" />
        </SelectParameters>

However rightnow, nothing is showing up in the gridview for the cart. How can I achieve my goal?

 var routeValuesDictionary = new RouteValueDictionary();
foreach (var key in Request.QueryString.AllKeys)
{
    routeValuesDictionary.Add(key, Request.QueryString[key]);
}
return RedirectToAction("ActionName", "Controller", new RouteValueDictionary(routeValuesDictionary));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM