473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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="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?

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

btnPopupWindow.Attributes.Add("OnClick","OpenWindo w('" + 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*********@yahoo.com> wrote in message
news:cc**************************@posting.google.c om...
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?

Thanks!
private void btnPopupWindow_Click(object sender,System.EventArgs e)
{
btnPopupWindow.Attributes.Add("OnClick","OpenWindo w('" + 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.Attributes.Add("onclick","return ss_onclick()");

function ss_onclick(){
window.showModalDialog("a.aspx");
{

you can even cancel postback from your client script function by setting
window.event.returnValue 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
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,...
2
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...
9
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)...
1
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...
22
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...
4
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...
2
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. ...
6
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...
0
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"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
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...

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.