i have some textbox and some imagebutton.
When i type something in textbox and click enter i want my TextChanged event to fire which is working fine but at the same time it clicks one image button also and calls the method of that image button.
Can ne please help me on this.
Thanks in Advance
Loading

Suthish NairRank #92 · 22.8K reputationPosted Oct 26, 2010, 10:09 PM EDT
can you post the relavent code...
Apurva Mehta34 reputationPosted Oct 26, 2010, 10:15 PM EDT
//Button at aspx page
<asp:ImageButton ID="Image1" runat="server" OnClick="imgItems_Click"
ImageUrl="~/image/factory.bmp"/>
//Code for button
protected void imgItems_Click(object sender, ImageClickEventArgs e)
{
if (Page.IsValid)
{
Response.Redirect("First.aspx?Id=" + Id);
}
}
//TextChange method
protected void txt_TextChanged(object sender, EventArgs e)
{
//Some Calculation
}
Suthish NairRank #92 · 22.8K reputationPosted Oct 27, 2010, 8:04 PM EDT
check couple of things..
1. document.forms["myform"].submit(); ==> remove this line if using.
2. search for ClientId imgItems on form, if any DefaultButton is used or not.
Apurva Mehta34 reputationPosted Oct 27, 2010, 8:26 PM EDT
Isolved the problem.The problem and RCA is below :
Problem : When user click enter on any part of screen it calls the first Image button to fires and execute the button method.
Solution : What i did i place another image button at first position on aspx page and set its Width=".1px" which cannot be seen during runtime and Onclick of this image button i am calling a empty method.So one user click enter it dont fire any other image button.
Suthish NairRank #92 · 22.8K reputationPosted Oct 27, 2010, 9:35 PM EDT
ok.. if the helped you... its good.