My problem now is that i need to click 2 time to do the search with right text to search. is there a way to cacth what i'm sending and update it? Is there another solution?
Hello!!
I have 2 radiobuttons that decides what search engine to use (google or mine), and i have 1 button that will submit a text that will be used to be searched in one of the 2 search engines. When i try to do the google search, the first time it just opens the new window when i click the 2nd time, it opens the google window with word that i want to search and if i try to do my search it do the both searchs. What i'm doing wrong ? how i put this working in the right way?
<table><tr>
<td>
<asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="Button1_Click" UseSubmitBehavior="true"/>
</td>
</tr>
<tr align="center">
<td>
<input id="Search1" value="one" type="radio" runat="server" name="sitesearch" />Site Name
<input id="Search2" value="two" type="radio" runat="server" name="sitesearch" />
<img src="http://www.google.com/images/poweredby_transparent/poweredby_FFFFFF.gif" alt="Google" />
</td>
</tr>
</table>
and then i have...
protected void Button1_Click(object sender, EventArgs e){
if (Search1.Checked)
{
//My Search
Response.Redirect(Request.UrlReferrer.AbsolutePath +...
}
else if (Search2.Checked)
{
//Google search
btnSearch.Attributes.Add("OnClick", "window.open('http://www.google.com/search?q=" + Regex.Replace(TextB.Text, " ", "+") + "','_blank');");
}
}
...and i have this...
TextBox TextB;
HtmlInputRadioButton radioBSite;
Button btnSearch;
HtmlInputRadioButton radioBGoogle;
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
TextB = (TextBox)FindControl("TextBox1");
TextB.Text = Request["find"];
radioBSite = (HtmlInputRadioButton)FindControl("Search1");
radioBSite.Checked = true;
radioBGoogle = (HtmlInputRadioButton)FindControl("Search2");
btnSearch = (Button)FindControl("btnSearch");
btnSearch.Click += new EventHandler(Button1_Click);
.
.
}