473,568 Members | 2,795 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

button click event being called twice on click

I have an button which calls its Click procedure twice when clicked.
This is my code :

public void btnAddToCartPer sonal_Click(obj ect sender,
System.Web.UI.I mageClickEventA rgs e)
{
//validate text boxes
bool blnEmpty = false;
string strQuantity;

//clear label
lbl1.Text = "";

for (int i=0; i < dgPersonalNumbe ring.Items.Coun t; i++)
{
strQuantity =
((TextBox)dgPer sonalNumbering. Items[i].FindControl("t xtQuantity")).T ext;

if (strQuantity == "")
{
blnEmpty = true;
}
}

if (blnEmpty == true)
{
lbl1.Text = "Please enter Quantity";
}

}

Does anybody know why it is getting called twice?
Thanks,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
1 1714
The handler for the event was probably added twice.

"mike parr" <mp********@yah oo.co.uk> wrote in message
news:O4******** ******@TK2MSFTN GP11.phx.gbl...
I have an button which calls its Click procedure twice when clicked.
This is my code :

public void btnAddToCartPer sonal_Click(obj ect sender,
System.Web.UI.I mageClickEventA rgs e)
{
//validate text boxes
bool blnEmpty = false;
string strQuantity;

//clear label
lbl1.Text = "";

for (int i=0; i < dgPersonalNumbe ring.Items.Coun t; i++)
{
strQuantity =
((TextBox)dgPer sonalNumbering. Items[i].FindControl("t xtQuantity")).T ext;

if (strQuantity == "")
{
blnEmpty = true;
}
}

if (blnEmpty == true)
{
lbl1.Text = "Please enter Quantity";
}

}

Does anybody know why it is getting called twice?
Thanks,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5127
by: Jason Kyle Baginski | last post by:
Here's a little test app to demonstrate a problem I'm having. It creates four buttons, each one with the different FlatStyle types available. Three of them behave exactly the same way(and the way I'd anticipate), but the FlatStyle.System one does not. If you click on any of the buttons, use the enter key, or the spacebar, they will bring...
2
4006
by: Oney | last post by:
I want to open a popup window when user click the web server button control When user click the button, only OnClik="OpenWindow(12)" is sent but no event happend no popup opened.After that, user click again popup window is open. So user must click twice! So I must raise event twice. How can I do that or do you advice any solution? ...
3
8746
by: Imran Aziz | last post by:
Hello All, I have a search text and button that post data and my button handler filters the repeater control. However when the button is clicked the first time. The page_load event is being called twice, once with postback true, and second time without postback. This only happens for this button. How can I sort out this issue, any clues what...
0
1548
by: Diffident | last post by:
Hello All, I have an asp:button and I have tied an eventhandler to this button's click event which means that the eventhandler should be executed everytime I click the button. But to my frustration, the eventhandler does not get executed everytime I click the button. I have to click the button twice at times to make sure that the event...
9
4730
by: mosscliffe | last post by:
I am sorry but I am all very new and slow at understanding all this ASP.NET2. I found some code which showed how to page with a repeater. All very excited as I had been looking for this all day. It worked wonderfully, but it was in C# So I converted it to VB with http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx It...
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
6275
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2101
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
932
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.