The Idea is that, when the user opts to sort by date, call these customized xml files to show results sorted out by date.
In the context file you will find the following tag
<Label name="_cse_bolrua_bzhw" mode="FILTER" />
<Label name="_cse_exclude_bolrua_bzhw" mode="ELIMINATE" />
Add the following Label to the xml file and save it in your website directory.
<Label name="recent4" mode="BOOST"/>
This tag does the trick.
Also Just before the </GoogleCustomizations> tag, add the following line:
<Include type="Annotations" href="http://www.yourwebsite.com/annotations.xml"/>
This references the annotations file that you downloaded from the "Advanced Console"
There wont be any change in the annotations file, except that a copy will reside on the server. Make sure that when you change the site restrictions (Adding/Removing folders/files for site search), compare your downloaded version with the one on the Custom search.
Based upon the Radio Button selection, just select the annotation file:
if (rbSearchby.SelectedValue == "r") //Search by Relevance
Response.Redirect(GetRoot() + "content/googlesearch.aspx?cx=01054907335329%3Abolrua_bzhw&cof=FORID%3A11&ie=UTF-8&q=" + HttpUtility.UrlEncode(SearchBox_TextBox.Text) + "&sa=Search");
//Search by Date
Response.Redirect(GetRoot() + "content/googlesearch.aspx?cref=http%3A%2F%2Fwww.yourwebsite.com%2Fgooglespecc.xml&cof=FORID%3A11&ie=UTF-8&q=" + HttpUtility.UrlEncode(SearchBox_TextBox.Text) + "&sa=Search");