Creating query strings

Creating query strings

Hi all,
 
I am trying to create a query string for one of my web part (sharepoint) project.
 
For example, when a user enters a value in text box and click on search button that will take the text box value to the query string. If the user enters "Oregon" click on search button , the value should be in URL like this http://sharepoint.com/sites/pages/default.aspx?state=Oregon
 
What would be the code for this ?
 
Thank you.