If you are using OOTB search web part then you can do this in client side, get
the query string in js and then do a redirection to the target page with the
query string value
Cheers,
Prashanth
Sent from my iPhone
On Sep 1, 2014, at 1:58 PM, Paul Noone p.no...@keller.com.au wrote:
Hi all,
Hi Prashanth,
Redirecting to the target page and appending the query is no problem.
However the Staff Lookup web part on the target page is a custom part. I want
to perform a search on page load if the key/value is present and then clear it
on postback. Hope that makes sense.
Regards,
Paul
Paul,
HttpContext.Current.Request.QueryString.Clear();
This will clear the querystring on the request object that is about to be
destroyed, so is probably not going to be a strategy that will work. You might
want to look into modifying the response object, but probably more likely to
succeed
That makes sense. I initially had it redirecting.
Would it be just as good to add the query string check into the click handler
for the Search button?
if (!String.IsNullOrEmpty(queryString)) {
Button1.PostBackUrl = queryString;
}
And would Request.QueryString.Remove(k) be just as effective?
Paul I think the click handler would be too late. I think you want to do it in
the initial pre-render
The life cycle would then be:
1. User clicks search in search webpart, cause navigation to URL with k
in query string
2. Your onload/prerender runs, receives the k param,
Yes, of course. OnPreRender lets me modify the controls after
CreateChildControls. Thanks.
Not worried about the user seeing it at all. Just wanting to remove it after
the query has it.
So I now have the following and it’s working like a charm. Thanks, James!
protected override void