473,666 Members | 2,302 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I raise Web Server Button control Click event twice? & JavaScript

I want to open a popup window when user click the web server button
control

When user click the button, only OnClik="OpenWin dow(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?

Thanks!
private void btnPopupWindow_ Click(object sender,System.E ventArgs e)
{
btnPopupWindow. Attributes.Add( "OnClick","Open Window('" + x +
"')");
// call btnPopupWindow_ Click(---,---); ??? It must be called
again to open popup
}
Nov 18 '05 #1
2 4014
Hi,
Put the following peace of your code in the Button pre render event :

btnPopupWindow. Attributes.Add( "OnClick","Open Window('" + x + "')");

This will deff work.
Currently what is happening is that after you press the button once the JS
is getting registered at that time.
So when you are clicking on the second time the JS is getting fired then.
Regards,
Zuzar L.

"Oney" <oz*********@ya hoo.com> wrote in message
news:cc******** *************** ***@posting.goo gle.com...
I want to open a popup window when user click the web server button
control

When user click the button, only OnClik="OpenWin dow(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?

Thanks!
private void btnPopupWindow_ Click(object sender,System.E ventArgs e)
{
btnPopupWindow. Attributes.Add( "OnClick","Open Window('" + x +
"')");
// call btnPopupWindow_ Click(---,---); ??? It must be called
again to open popup
}

Nov 18 '05 #2
Hi,

You don't need to raise event twice. you can use button attributes on
Page_Load to add button client side script that catch click event,
display message and just then continue and submit the page to server :

this.Button1.At tributes.Add("o nclick","return ss_onclick()");

function ss_onclick(){
window.showModa lDialog("a.aspx ");
{

you can even cancel postback from your client script function by setting
window.event.re turnValue to false.

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 18 '05 #3

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

Similar topics

12
12421
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank, 'height=200,width=400,status=no,toolbar=no, menubar=no,location=no resizable=no scrollable=no'); but I can't seem to invoke the client side script from within a Server Side Form. I know I can use the context with to Response.redirect or Server.transfer to return a
2
4332
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control displaying the contents of the data source, whilst another control updates the datasource via a command buttons implementation of 'Click', an event raised in the 'Handle Postback Events' stage of the control execution life cycle (via the...
9
2219
by: AFN | last post by:
I was just dropped into someone else's code (isn't that always so fun?). I can't figure out why a custom validation control's server event function is executing. There is nothing (that I see) in page_load, or elsewhere, that says page.validate, no control says "causesvalidation=true", and the AutoEventWireup is set to false. So I would think that the control's server event function would NOT execute, but it does execute right after...
1
1572
by: Perry van Kuppeveld | last post by:
Hi, I would like to submit a form through scripting, and still retrieve the click event on the server. See code below to test some stuff. Create a C# webapplication and replace the WebForm1 class with the code below. While running the program, give the textarea the focus and press enter. See the dif with clicking submit.
22
2174
by: Mr Newbie | last post by:
I was thinking about developing a workflow application yesterday and was musing over the different approaches than one could take in restricting specific actions on a ticket( Form ) at any said stage. One approach I have used on other systems is to prevent the action buttons appearing. For example, if one did not have the Role of Administrator, one would be prevented from deleting a ticket not created by oneself. However, it did occur...
4
3500
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I click a button on a pop-up window the javascript for that button click does a 'button.form.submit'. On the Server side there is a Button click event for this button, but for some reason it no longer fires. It worked fine before and everything...
2
2880
by: Dave | last post by:
Hello, I'm starting with asp.net and i don't know how to raise the SelectedIndexChange event when clicking in a dropdownlist control. I thought it was the same as by clicking on a button. This is what i did: <asp:DropDownList ID="DropDownList1" runat="server"> </asp:DropDownList>
6
2523
by: den 2005 | last post by:
Hi everybody, Question 1: How do you set the values from server-side to a client-side control or how do you execute a javascript function without a button click event? Question 2: How do you get response from a Confirm() popup window to uncheck all server-side checkboxes placed in a panle of a web user control? I am using ASP.Net 2.0, Thanks. Need info...
0
2322
by: Roberto Kohler | last post by:
I created an enhanced Button Control in ASP NET 2.0 to add a delete confirmation message and to disable the button if the user does not have access. The new button control has a "ConfirmMessage" property where you can set the message you want displayed and a "SecurityKey" property to set the security key for the button. The securitykey works fine. The button is disabled if the user should not have access to it. The problem I have is...
0
8443
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
8781
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
8550
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
6192
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
5663
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
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
2769
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
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1772
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.