Communicate cross Page WebParts using Query Strings

If you want to communicate with a webpart which is not in the current page, then you got a problem. If you want to pass a set of rows to the webpart, then go for cross webpart connections. Details of cross webpart Page connection can be found in below link
http://msdn.microsoft.com/en-us/library/ms469765.aspx

But If you have less number of parameters to pass, then I suggest you go for Query strings. In this article, I am describing how to work with query strings.

1.Redirecting the user from the donor webpart page to the Page having Acceptor webpart

string desiredURL = "http://www.moss2k:8080/ITServices";
//Replace desired Url with your page url of the acceptor webpart
string business= “Health”;
this.Page.Response.Redirect(WebUrl + "?mode=f&b=" + business);


Here I have passed two query strings,one is “mode” whose value is “f” and “b” whose value is assigned to a variable “business”

2.Getting the Values of query String in Acceptor webpart

this.Page.Request.QueryString[“mode”].ToString();
this.Page.Request.QueryString[“b”].ToString();


this will give you value “f” and “health” respectively