Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How can I raise Web Server Button control Click event twice? & JavaScript

Reply
Thread Tools

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

 
 
Oney
Guest
Posts: n/a
 
      05-16-2004
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
}
 
Reply With Quote
 
 
 
 
Zuzar Lakdawala
Guest
Posts: n/a
 
      05-17-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
> }



 
Reply With Quote
 
 
 
 
Natty Gur
Guest
Posts: n/a
 
      05-17-2004
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
image button click event fires before click event of button Purvi T ASP .Net 0 10-19-2004 06:19 AM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net Building Controls 1 05-28-2004 06:23 AM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net 2 05-25-2004 11:45 PM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net Datagrid Control 0 05-25-2004 01:45 AM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net Web Controls 0 05-25-2004 01:45 AM



Advertisments