473,699 Members | 2,701 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Button OnClick not firing on first click

SAL
Hello,
I have a button on a webform that has an OnClick event defined as such:

<asp:Button ID="btnSearchBy Name" runat="server" Text="Search By Name"
OnClick="btnSea rchByName_Click " Width="152px" EnableViewState ="False"
CausesValidatio n="False" />

the btnSearchByName _Click event fires the second time the button is clicked
but not the first. Is there something I'm missing on getting the thing to
fire the first time it's clicked instead of the second time?

Thanks
S
May 29 '07 #1
8 17587
On May 29, 8:07 pm, "SAL" <S...@NoNo.comw rote:
Hello,
I have a button on a webform that has an OnClick event defined as such:

<asp:Button ID="btnSearchBy Name" runat="server" Text="Search By Name"
OnClick="btnSea rchByName_Click " Width="152px" EnableViewState ="False"
CausesValidatio n="False" />

the btnSearchByName _Click event fires the second time the button is clicked
but not the first. Is there something I'm missing on getting the thing to
fire the first time it's clicked instead of the second time?
what's the code of btnSearchByName _Click?

May 29 '07 #2
SAL
Public Sub btnSearchByName _Click(ByVal sender As Object, ByVal e As
System.EventArg s)
Dim abll As New AnnexationsBLL
If Not txtSearchByName Is Nothing Then
gvAnnexations.D ataSource =
abll.GetAnnexat ionsByName(txtS earchByName.Tex t)
gvAnnexations.D ataSourceID = Nothing
gvAnnexations.D ataBind()
End If
End Sub

However, it doesn't even break into this routine on the first click
(breakpoint is on the If statement). What the heck? Sometimes it works and
sometimes it doesn't. Is this some kind of ASP.NET (2.0) bug or something?

S

"Alexey Smirnov" <al************ @gmail.comwrote in message
news:11******** *************@g 37g2000prf.goog legroups.com...
On May 29, 8:07 pm, "SAL" <S...@NoNo.comw rote:
>Hello,
I have a button on a webform that has an OnClick event defined as such:

<asp:Button ID="btnSearchBy Name" runat="server" Text="Search By Name"
OnClick="btnSe archByName_Clic k" Width="152px" EnableViewState ="False"
CausesValidati on="False" />

the btnSearchByName _Click event fires the second time the button is
clicked
but not the first. Is there something I'm missing on getting the thing to
fire the first time it's clicked instead of the second time?

what's the code of btnSearchByName _Click?

May 29 '07 #3
On May 29, 9:12 pm, "SAL" <S...@NoNo.comw rote:
Public Sub btnSearchByName _Click(ByVal sender As Object, ByVal e As
System.EventArg s)
Dim abll As New AnnexationsBLL
If Not txtSearchByName Is Nothing Then
gvAnnexations.D ataSource =
abll.GetAnnexat ionsByName(txtS earchByName.Tex t)
gvAnnexations.D ataSourceID = Nothing
gvAnnexations.D ataBind()
End If
End Sub

However, it doesn't even break into this routine on the first click
(breakpoint is on the If statement). What the heck? Sometimes it works and
sometimes it doesn't. Is this some kind of ASP.NET (2.0) bug or something?
hmm, try to set EnableViewState to true, maybe this can change that?
May 29 '07 #4
SAL
Yep, already tried that and it doesn't seem to have any effect.

S

"Alexey Smirnov" <al************ @gmail.comwrote in message
news:11******** ************@j4 g2000prf.google groups.com...
On May 29, 9:12 pm, "SAL" <S...@NoNo.comw rote:
>Public Sub btnSearchByName _Click(ByVal sender As Object, ByVal e As
System.EventAr gs)
Dim abll As New AnnexationsBLL
If Not txtSearchByName Is Nothing Then
gvAnnexations.D ataSource =
abll.GetAnnexa tionsByName(txt SearchByName.Te xt)
gvAnnexations.D ataSourceID = Nothing
gvAnnexations.D ataBind()
End If
End Sub

However, it doesn't even break into this routine on the first click
(breakpoint is on the If statement). What the heck? Sometimes it works
and
sometimes it doesn't. Is this some kind of ASP.NET (2.0) bug or
something?

hmm, try to set EnableViewState to true, maybe this can change that?


May 29 '07 #5
On May 29, 9:25 pm, "SAL" <S...@NoNo.comw rote:
Yep, already tried that and it doesn't seem to have any effect.
Well, I don't see any error here. I think you have a validation
controls and/or a client script that makes this strange effect. If you
cannot find an error, send a full code of your webform, I will try to
look into it.
May 29 '07 #6
SAL
Alexey,
if you are still listening to this thread,
I've found an interesting effect. If I tab out of the text box, the field
that is used to limit results by the button click event, the page refreshes
and in that circumstance, the button click event fires and limits the
results on the first click. I don't really get why this is happening.
This page that we've been discussing is using a master page, if that
matters, and I set the AutoEventWireup to true prior to this little effect.

S

"Alexey Smirnov" <al************ @gmail.comwrote in message
news:11******** **************@ q66g2000hsg.goo glegroups.com.. .
On May 29, 9:25 pm, "SAL" <S...@NoNo.comw rote:
>Yep, already tried that and it doesn't seem to have any effect.

Well, I don't see any error here. I think you have a validation
controls and/or a client script that makes this strange effect. If you
cannot find an error, send a full code of your webform, I will try to
look into it.


May 30 '07 #7
On May 30, 7:29 pm, "SAL" <S...@NoNo.comw rote:
Alexey,
if you are still listening to this thread,
I've found an interesting effect. If I tab out of the text box, the field
that is used to limit results by the button click event, the page refreshes
and in that circumstance, the button click event fires and limits the
results on the first click. I don't really get why this is happening.
This page that we've been discussing is using a master page, if that
matters, and I set the AutoEventWireup to true prior to this little effect.
Try make a copy of the form, remove all controls except the one which
failed and see if it helps. There is something that affects on it.

May 30 '07 #8
SAL
Well, I did that and it seems to be working as expected now. I had a label
control on the page with an ID="lblSearchBy Name"
and the textbox's ID="txtSearchBy Name"
It's hard to believe it would get confused by this but maybe.

So now, the textbox is behaving more as one would expect. When I start to
type in a name, it shows previously typed in names that begin with the
letters I'm typing. It wasn't doing that before. Also, when I tab out of the
textbox, the page does not refresh as it should not.

Thank you very much for your help.
S

"Alexey Smirnov" <al************ @gmail.comwrote in message
news:11******** **************@ g4g2000hsf.goog legroups.com...
On May 30, 7:29 pm, "SAL" <S...@NoNo.comw rote:
>Alexey,
if you are still listening to this thread,
I've found an interesting effect. If I tab out of the text box, the field
that is used to limit results by the button click event, the page
refreshes
and in that circumstance, the button click event fires and limits the
results on the first click. I don't really get why this is happening.
This page that we've been discussing is using a master page, if that
matters, and I set the AutoEventWireup to true prior to this little
effect.

Try make a copy of the form, remove all controls except the one which
failed and see if it helps. There is something that affects on it.

May 30 '07 #9

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

Similar topics

2
3866
by: alien2_51 | last post by:
Can some one tell me why the onclick is firing twice for the radion button and checkbox controls...? <%@ Page Language="vb" AutoEventWireup="false" Codebehind="Testing.aspx.vb" Inherits="CustomerRelations.Testing" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <title>Testing</title> <!--
14
7184
by: Sinity | last post by:
Anyone knows the method/codes to disable the clicked button after first click by using .aspx-- to prevent people to click many time when waiting for the server response. I tried to do this by adding a java script for the button. But, useless.. Please help! Thank you
1
8160
by: Earl Teigrob | last post by:
PROBLEM: When a user control is loaded into a PlaceHolder control more than once, the events do not fire on the first click of a control on the dynamically loaded user control. In other words, the first time the control is dynamically loaded, everything works fine. After that, if the control is loaded again from the page button event handler, the user controls events fail to fire on the first click NOTE: I (believe I) am rebuilding all...
2
1456
by: Eric Sabine | last post by:
I have code in my page_load event that definitely gets fired because I can step through it. But code wired to my button_click event isn't getting fired. The control is of type system.web.ui.webcontrols.button. If I double-click on the control in the design window, I am taken to the appropraite control's click event and can see my code which _should_ file. But at runtime, the code doesn't fire. I don't get it. Any ideas? Eric
2
4872
by: Curt_C [MVP] | last post by:
I've got a Repeater and within it a LinkButton. The LinkButton has an CommandName="Test" In the Repeater's ItemCommand event I want to check for this command name but the problem I'm having is that the ItemCommand event is not firing the first time the LinkButton is clicked. 2nd-(n)times after it's fine but the FIRST time it's clicked I get nothing. The repeater is on an ASCX control that's on a standard ASPX page.
11
11240
by: cindy | last post by:
I have a form, has javascript registered so a modal pops up. Button click will close form. Now I need to do an update with modal form data before it closes. I can put a second button and register the onclick attribute of the second button to the javascript to close the form after user clicks upload button click upload do the update to database then programmatically click the second button the use on onclick attribute that sees the...
7
3572
by: rsaffy | last post by:
I am having trouble with my dynamically created button's event handling. I read that the buttons need to be recreated on every trip to the server, but how exactly do you do that when the datagrid the button is added to is created at run time? here is code from my aspx page... ------------------------------------------------------------------------------------- <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">...
3
2075
by: ismailc | last post by:
Good day, I need help Please I'm coding within a VBScript window and executing a javscript clientside. The problem i have the below code ONCLICK executes the first click "Done.click()" only and not the second click "___Submit.click()" fcLabel = "<INPUT type=button value='Process Data' onclick=Done.click(); ___Submit.click() language='javascript'>" It works when i only have one click within the ONCLICK but not two.
4
3619
by: ismailc | last post by:
Good day, I need to use the value of the name to an html button onclick click function. <xsl:element name="asp:CheckBox"> <xsl:attribute name='id'><xsl:value-of select='@name' /></xsl:attribute> <xsl:attribute name='runat'>server</xsl:attribute> </xsl:element> <input id="btnDone" type="button" value="Done" onClick="@name.click();">
0
8686
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9173
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9033
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8911
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6533
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4375
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3057
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
2
2345
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2009
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.