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,
>
> I have a custom people search web part which uses a simple form, SPGrid and a
> DataTable.
>
> <image003.jpg>
>
> I’d like to extend this so that people can search for staff from another page
> via a Search Box.
>
> <image004.png> …where k=”Paul"…
>
> What I want to do is:
>
> 1. Check if the "k" param has a value.
> 2. Use it in my query and apply it to the datasource’s filter
> expression.
> 3. Clear the query string on postback.
>
> I’ve added the following to the OnLoad event but it throws a NullReference
> exception.
>
> Any help appreciated.
>
> // Get URL and check for "k" query string param in case of search from
> another page
> String txtNameFromQuery = HttpContext.Current.Request.QueryString["k"];
>
> if(!String.IsNullOrEmpty(txtNameFromQuery))
> {
> // Set txtName field to query string value for additional searches
> txtName.Text = txtNameFromQuery;
>
> // Define the search query
> String q = "Name LIKE '%" + txtNameFromQuery + "%'";
>
> // Apply query to filterexpression
> ds.FilterExpression = q;
> ViewState["FilterExpression"] = (String)ds.FilterExpression;
>
> // Remove any query string parameters from the URL
> HttpContext.Current.Request.QueryString.Clear();
> }
>
> Regards,
>
> Paul
>
> The content of this email is confidential to the intended recipient at the
> email address to which it has been addressed. It may not be disclosed to, or
> used by, anyone other than this addressee, nor may it be copied in any way.
> If received in error, please contact the author and then delete the message
> from your system.
> Please note that neither Keller Australia nor the sender accepts any
> responsibility for viruses and it is your responsibility to scan the email
> and attachments (if any).
> Visit http://www.keller.com.au/ for more information.
>
> This e-mail message has been scanned for Viruses and Content and cleared by
> MailMarshal
>
> _______________________________________________
> Sponsored by Infotext - Amazing Search for Microsoft SharePoint -
> http://www.infotext.com/
> ozmoss mailing list
> ozmoss@ozmoss.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
_______________________________________________
Sponsored by Infotext - Amazing Search for Microsoft SharePoint -
http://www.infotext.com/
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
_______________________________________________
Sponsored by Infotext - Amazing Search for Microsoft SharePoint -
http://www.infotext.com/
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss