<script language=javasc ript>
function selectFile(file Url)
{
if(navigator.ap pName.indexOf(' Microsoft')!=-1)
window.returnVa lue=fileUrl;
else
window.opener.s etAssetValue(fi leUrl);
self.close();
}
</script>
<asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox>
<asp:Button ID="Button1" runat="server"
OnClientClick=" selectFile('bla bla')" Text="Button" />
When I run this code for some reason, it seems to do it twice. Also,
the first time I press the button the window is still open, but the
second time I press the button it correctly closes the window.
Any idea what is going on?
Also do you know the syntax of how I can pass the parameter of the text
in textbox1 instead of the 'blabla' to the javascript function? 4 3810
Generally when an event fires twices it's because an event handler is
registered twice. Maybe you have it registered both in the code behind and
the html?
"Steve" <ba****@iranman ia.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. . <script language=javasc ript> function selectFile(file Url) { if(navigator.ap pName.indexOf(' Microsoft')!=-1) window.returnVa lue=fileUrl; else window.opener.s etAssetValue(fi leUrl); self.close(); } </script>
<asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox> <asp:Button ID="Button1" runat="server" OnClientClick=" selectFile('bla bla')" Text="Button" />
When I run this code for some reason, it seems to do it twice. Also, the first time I press the button the window is still open, but the second time I press the button it correctly closes the window.
Any idea what is going on?
Also do you know the syntax of how I can pass the parameter of the text in textbox1 instead of the 'blabla' to the javascript function?
No, I haven't specified anything in the code behind.
Use an HTML button, not an asp.net ?
"Rick" <Ri**@nowhere.c om> schreef in bericht
news:us******** ******@TK2MSFTN GP14.phx.gbl... Generally when an event fires twices it's because an event handler is registered twice. Maybe you have it registered both in the code behind and the html?
"Steve" <ba****@iranman ia.com> wrote in message news:11******** **************@ g14g2000cwa.goo glegroups.com.. . <script language=javasc ript> function selectFile(file Url) { if(navigator.ap pName.indexOf(' Microsoft')!=-1) window.returnVa lue=fileUrl; else window.opener.s etAssetValue(fi leUrl); self.close(); } </script>
<asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox> <asp:Button ID="Button1" runat="server" OnClientClick=" selectFile('bla bla')" Text="Button" />
When I run this code for some reason, it seems to do it twice. Also, the first time I press the button the window is still open, but the second time I press the button it correctly closes the window.
Any idea what is going on?
Also do you know the syntax of how I can pass the parameter of the text in textbox1 instead of the 'blabla' to the javascript function?
Since you are using C# I would double check where the designer hooks the
events.
I have seen it subscribe twice to an event due to manual deletion and
recreation of buttons.
I had the same problem a year or so ago.
HTH
SA
"Steve" <ba****@iranman ia.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. . No, I haven't specified anything in the code behind. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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>
<!--
|
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.
...
|
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
|
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...
|
by: Buddy Ackerman |
last post by:
I want to disable a form button after it's pressed so that the user can't
click it twice. So, I set the onClientClick property to
"this.disabled=true;return true;". This has the effect of disabling the
server side eventhandler for this button so that the form doesn't process
properly anymore. Why does onClientClick disable my server side
eventhandler.
--Buddy
| |
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...
|
by: TS |
last post by:
I have this custom data list control and i override the onItemDatabound
event. After upgrading to vs 2005, this event is not always getting called,
though it does at other times. No changes were made when upgrading to 2.0
is there any reason for this because of .net 2.0?
thanks
|
by: Dan |
last post by:
Hi,
i try to redirect to another aspx page with jscript. I use "OnClientClick"
but nothing happens.
I tried two ways.
What am i doing wrong?
Thanks
Dan
....
|
by: =?Utf-8?B?RWFnbGVSZWRASGlnaEZseWluZ0JpcmRzLmNvbQ== |
last post by:
I am having trouble getting client-side events to fire on ImageButtons.
Instead I am seeing postbacks. The client-side handlers end with "return
false;" but they are never called.
<asp:ImageButton id="myButton" runat="server"
OnClientClick="myButtonClick();" src=... ></asp:ImageButton>
In the javascript:
function myButtonClick()
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |