Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

button click postback needs double click

Status
Not open for further replies.

jgurgen

Programmer
Mar 9, 2006
192
US
i have a simple button that when clicked it just updates a label but everytime i click it once nothing happens but if i click it a second time then it does a postback and will change to label. Why does it take two clicks? This is happening with a few buttons but not all of them.

protected void IOD_InterestRate_Update_Button_Click(object sender, EventArgs e)
{
string InterestRate = "";

if (IOD_InterestRate.Text.EndsWith("%"))
{
InterestRate = IOD_InterestRate.Text.TrimEnd('%');
IOD_Label2.Text = InterestRate;
}
else
{
IOD_Label2.Text = IOD_InterestRate.Text;
IOD_InterestRate.Text = IOD_InterestRate.Text + "%";
}
}
 
You will have to trace through the code. Any time a server button is pressed, it causes a post back. You just may not be seeing the result as you expect. Try stepping through your code and see what happens.

Jim
 
i cant find anything, there is over 3000 lines and its only new buttons that i add that are having this problem
 
fixed it
had autopostback on the textbox that i was calling set to true. Changed it to false and it worked perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top