I have a ASP.NET Web Form Project, in the master page I have a button(searchButton), I wrote a code in searchButton_Click event, after clicking on "Go" button (also if user types something in the textbox and press Enter key), user will be redirected to another page(FrmSearchResult.aspx)
public partial class Site1 : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void searchButton_Click(object sender, EventArgs e)
{
Session["nameA"] = searchText.Text;
Response.Redirect("FrmSearchResult.aspx");
Session.RemoveAll();
}
}
}
I also have Default.aspx page which has mentioned master page!
In the default page I have a textbox (searchUniTextBox), and I implemented a code in searchUniTextBox_ValueChanged event!
protected void searchUniTextBox_ValueChanged(object sender, EventArgs e)
{
string searchUni = searchUniTextBox.Text.ToLower();
string[] uniItem = new string[CheckBoxList1.Items.Count];
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items[i].Text.ToLower().Contains(searchUni))
CheckBoxList1.Items[i].Selected = true;
}
}
But the problem is that whenever user presses Enter key, this event (searchUniTextBox_ValueChanged) executes, and immediately after that searchButton_Click in the master page executes!!!!!
I do not how I can prevent executing searchButton_Click event in the master page, when searchUniTextBox_ValueChanged event fires??
Thank you so much