G
Guest
Problem
I have a problem with web image button control click event. The click event does not get trigger until it has not been clicked once or page refresh occures(which is fine).
When click event fires first time it executes code associate with click event(As I expected). the problem is when you refresh page it fires a click event automatically.
I looked around many posts and did not find any topics about this problem. Infact the same behavior occured for regular web button control click event too.
Any ideas..
My test example
Let say you have webproject and page name is WebForm1
Drop one textbox control and one imagebox control on webpage form
Double click on Imagebox control.
It will create following event
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
//some code
}
Set break point on private void ImageButton1_Click
Test1: Hit page refresh button on IE
Result: nothing will happen ( I mean private void ImageButton1_Click will not trigger)
Test2: type some text in textbox and click image button.
Result: private void ImageButton1_Click will trigger and it will stop at break point.
Hit Debug->Continue again
Test3: do not do any thing after Test2. Just hit page refresh button on IE
Result: private void ImageButton1_Click will trigger.
Why ? I want to have private void ImageButton1_Click occure only when Imagebutton click occurs not on page refresh.
I have a problem with web image button control click event. The click event does not get trigger until it has not been clicked once or page refresh occures(which is fine).
When click event fires first time it executes code associate with click event(As I expected). the problem is when you refresh page it fires a click event automatically.
I looked around many posts and did not find any topics about this problem. Infact the same behavior occured for regular web button control click event too.
Any ideas..
My test example
Let say you have webproject and page name is WebForm1
Drop one textbox control and one imagebox control on webpage form
Double click on Imagebox control.
It will create following event
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
//some code
}
Set break point on private void ImageButton1_Click
Test1: Hit page refresh button on IE
Result: nothing will happen ( I mean private void ImageButton1_Click will not trigger)
Test2: type some text in textbox and click image button.
Result: private void ImageButton1_Click will trigger and it will stop at break point.
Hit Debug->Continue again
Test3: do not do any thing after Test2. Just hit page refresh button on IE
Result: private void ImageButton1_Click will trigger.
Why ? I want to have private void ImageButton1_Click occure only when Imagebutton click occurs not on page refresh.