473,698 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

onclick firing twice for CheckBox and RadioButton...


Can some one tell me why the onclick is firing twice for the radion button
and checkbox controls...?

<%@ Page Language="vb" AutoEventWireup ="false" Codebehind="Tes ting.aspx.vb"
Inherits="Custo merRelations.Te sting" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Testin g</title>
<!--
<script for="ckbCheckBo x" event="onclick" >
alert('ckbCheck Box click' +
document.getEle mentById("hdnAc tiveElementID") .value);
//document.getEle mentById("hdnAc tiveElementID") .value = this.id;
</script>
-->
<script language="jscri pt">

function doOnClickBody() {
//document.getEle mentById("hdnAc tiveElementID") .value =
document.active Element.id
alert(document. activeElement.o ffsetTop);
//alert('doOnClic kBody click ' +
document.getEle mentById("hdnAc tiveElementID") .value);
}

function doOnLoadBody() {
var selectedElement Name =
document.getEle mentById("hdnAc tiveElementID") .value;
//alert('doOnLoad Body load ' +
document.getEle mentById("hdnAc tiveElementID") .value);
if (selectedElemen tName != ""){
document.getEle mentById(select edElementName). focus();
}
}
</script>
<meta name="GENERATOR " content="Micros oft Visual Studio.NET 7.0">
<meta name="CODE_LANG UAGE" content="Visual Basic 7.0">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body onclick="doOnCl ickBody();" onload="doOnLoa dBody();"
ms_positioning= "GridLayout ">
<form id="Form1" method="post" runat="server">
<asp:CheckBox id="ckbCheckBox " style="Z-INDEX: 101; LEFT: 58px; POSITION:
absolute; TOP: 124px" runat="server" Text="Check Box"></asp:CheckBox>
<asp:RadioButto n id="radRadio" style="Z-INDEX: 102; LEFT: 59px; POSITION:
absolute; TOP: 159px" runat="server" Text="Radio Button"></asp:RadioButton >
<asp:TextBox id="hdnActiveEl ementID" style="Z-INDEX: 103; LEFT: 48px;
POSITION: absolute; TOP: 281px" runat="server" Width="562px"></asp:TextBox>
<asp:TextBox id="hdnScrollTo p" style="Z-INDEX: 104; LEFT: 48px; POSITION:
absolute; TOP: 309px" runat="server" Width="562px"></asp:TextBox>
<asp:DropDownLi st id="DropDownLis t1" runat="server" style="Z-INDEX: 105;
LEFT: 61px; POSITION: absolute; TOP: 83px" Width="201px"
AutoPostBack="T rue">
<asp:ListItem Value="book">bo ok</asp:ListItem>
<asp:ListItem Value="paper">p aper</asp:ListItem>
</asp:DropDownLis t>
</form>
</body>
</HTML>

Nov 17 '05 #1
2 3865
Hi,

Just want to inform you that I try your code and its run as expected
(one event).

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #2
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">"

basically is 1997 or 1998.
What is all the other crap about.

==========

It fires twice ?

--------

"Visual Basic 7.0"
Each time yo pay for it, right.


"alien2_51" <dan.billow"at" n.o.s.p.a.m.mon acocoach.commer cialversion> wrote
in message news:%2******** **********@TK2M SFTNGP10.phx.gb l...

Can some one tell me why the onclick is firing twice for the radion button
and checkbox controls...?

<%@ Page Language="vb" AutoEventWireup ="false" Codebehind="Tes ting.aspx.vb" Inherits="Custo merRelations.Te sting" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Testin g</title>
<!--
<script for="ckbCheckBo x" event="onclick" >
alert('ckbCheck Box click' +
document.getEle mentById("hdnAc tiveElementID") .value);
//document.getEle mentById("hdnAc tiveElementID") .value = this.id;
</script>
-->
<script language="jscri pt">

function doOnClickBody() {
//document.getEle mentById("hdnAc tiveElementID") .value =
document.active Element.id
alert(document. activeElement.o ffsetTop);
//alert('doOnClic kBody click ' +
document.getEle mentById("hdnAc tiveElementID") .value);
}

function doOnLoadBody() {
var selectedElement Name =
document.getEle mentById("hdnAc tiveElementID") .value;
//alert('doOnLoad Body load ' +
document.getEle mentById("hdnAc tiveElementID") .value);
if (selectedElemen tName != ""){
document.getEle mentById(select edElementName). focus();
}
}
</script>
<meta name="GENERATOR " content="Micros oft Visual Studio.NET 7.0">
<meta name="CODE_LANG UAGE" content="Visual Basic 7.0">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body onclick="doOnCl ickBody();" onload="doOnLoa dBody();"
ms_positioning= "GridLayout ">
<form id="Form1" method="post" runat="server">
<asp:CheckBox id="ckbCheckBox " style="Z-INDEX: 101; LEFT: 58px; POSITION: absolute; TOP: 124px" runat="server" Text="Check Box"></asp:CheckBox>
<asp:RadioButto n id="radRadio" style="Z-INDEX: 102; LEFT: 59px; POSITION: absolute; TOP: 159px" runat="server" Text="Radio Button"></asp:RadioButton > <asp:TextBox id="hdnActiveEl ementID" style="Z-INDEX: 103; LEFT: 48px;
POSITION: absolute; TOP: 281px" runat="server" Width="562px"></asp:TextBox> <asp:TextBox id="hdnScrollTo p" style="Z-INDEX: 104; LEFT: 48px; POSITION: absolute; TOP: 309px" runat="server" Width="562px"></asp:TextBox>
<asp:DropDownLi st id="DropDownLis t1" runat="server" style="Z-INDEX: 105; LEFT: 61px; POSITION: absolute; TOP: 83px" Width="201px"
AutoPostBack="T rue">
<asp:ListItem Value="book">bo ok</asp:ListItem>
<asp:ListItem Value="paper">p aper</asp:ListItem>
</asp:DropDownLis t>
</form>
</body>
</HTML>


Nov 17 '05 #3

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

Similar topics

3
3991
by: Doug | last post by:
Hi, I wondering if anyone has noticed this and has a workaround. I've set up a delegate for the SelectedIndexChange event and noticed that it is firing twice - does nayone else have this"problem" and have a workaround for it? Thanks in advance... Doug
1
3583
by: rozrabiak | last post by:
Hi! I have problem witch Windows forms, CheckBox, RadioButton, ComboBox and database. How can I use checkbox (and other components) in database? I want to check the checkbox in My form and save changes in to database, but it return me an Exception: "Nothing changed", WHY? I'm using MSSQL MSDE.
7
2343
by: Shane Bishop | last post by:
I've been fighting with the Page_Load event firing twice. I looked through this user group and saw several other people having similar problems. There were various reasons for it: AutoEventWireup="true" instead of AutoEventWireup="false" Spyware software And having your events all wired wrong I had done everything to my machine, stripped it down to just have ..NET on it and I was still having this problem until...
4
6090
by: Larry Morris | last post by:
The following code, pasted into a web form with a link button on it, will cause the page_unload event to fire twice. If I remove the response.redirect, the problem goes away :). I've got a work around, but I'm curious how one is supposed to programmatically navigate between web pages without the page_unload event firing twice. Thanks, Larry
4
3981
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques was endeavoring to create a custom user control to make things a bit simpler, but she noticed that her Page_Load eventhandler was firing twice. So after long hours of research and experimentation, I stumbled upon, imho, is quite the discovery. ...
28
10261
by: Tim_Mac | last post by:
hi, i'm new to .net 2.0, and am just starting to get to grips with the gridview. my page has autoEventWireUp set to true, which i gather is supposed to figure out which handlers to invoke when appropriate based on your method names . the GridView has OnRowCommand="GridView1_RowCommand" in the aspx. my problem is that the RowCommand event is firing twice (95% of the time) on the page. the other 5% it only fires once. there's no
4
7916
by: Brian P | last post by:
I have a service that is driven by a timer that fires every 5 seconds. For the most part, it works fine. But every once in a while the timer fires twice. In the log I can see that when it fires twice, there are two threads running. This causes problems so I need to find a way to fix it. So, my question is, do I need to use a Monitor to lock in my timer_elapsed event handler? Thanks for any advice...
4
4287
by: ShaneFowlkes | last post by:
I have a odd thing happening. I have a sub that is called upon a button click and it seems to be firing TWICE. I have no idea how this is happening but I suspect is has something to do with page_load and IsPostBack. The page has a form that displays a record. The user can delete the record by clicking a delete button or update it by clicking an update button. The delete sub calls a couple of other subs and functions and then displays a...
2
1450
by: ann | last post by:
I have a datagrid control I am using - the edit & update events are firing twice. I searched on google and see others have had same issue not just with datagrid but with other controls, but no resolution except to try "AutoEventWireup="false" , which it already is and it doesn't fix it. Can anyone help me? c# & net 1.1 thanks
0
8608
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9164
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
9029
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...
0
8870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7734
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6524
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3051
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
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.