473,320 Members | 1,802 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,320 software developers and data experts.

fire button event programmatically

From an aspx page (A.aspx) I open another one (B.aspx -
for table lookup). When the user selects an entry in
B.aspx I would like to force a button's event in A.aspx
to be fired. I guess the only way is using javascript -
does anybody have a sample for this ?
Thanks
Nov 17 '05 #1
5 6763
Lewis,
It looks interesting but I thing something went lost
during copy/paste, your code stops right when it starts
to become interesting.
Thanks
-----Original Message-----
Thanks, Steve for the suggestions.

Carlo, here is a sample for your reference.

WebForm1.aspx:
There is a href and a Button1[server control] on it.

<a
href="javascript:test=window.open ('WebForm2.aspx','test','width=300,height=188');test.focus()">TEST</a>

Button1'event:

private void Button1_Click(object sender, System.EventArgs e){
Response.Write ("Button1_Clicked~!");
}

WebForm2.aspx:

Drag a Literal control and a Button1 from the Toolbox to the page.
private void Button1_Click(object sender, System.EventArgs e){
string strjscript = "<script language='javascript'>alert ('fire');"; strjscript += "window.opener.Form1.Button1.click ();";//Form1 is the default form name of WebForm1.aspx
strjscript += "</script" + ">";
Literal1.Text = strjscript;
}

Please let me know if it meets your need. Thanks.

Hope this helps

Lewis

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "Carlo Marchesoni" <ca*****@trix.com>
| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| Subject: fire button event programmatically
| Date: Tue, 29 Jul 2003 11:12:20 -0700
| Lines: 6
| Message-ID: <01****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcNV/PORCJM8aNh4SiaWEZ4VauLzTg==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:163071| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| From an aspx page (A.aspx) I open another one (B.aspx -
| for table lookup). When the user selects an entry in
| B.aspx I would like to force a button's event in A.aspx| to be fired. I guess the only way is using javascript - | does anybody have a sample for this ?
| Thanks
|

.

Nov 17 '05 #2
Hi Carlo,

Thank you for your reply.

The sample in my previous reply is just a snippet for demonstration.

I would also like to recommend one good article to you.
http://aspnet.4guysfromrolla.com/articles/030202-1.aspx

Please let me know if you need more information, thanks.

Best Regards

Lewis

--------------------
| Content-Class: urn:content-classes:message
| From: "Carlo Marchesoni" <ca*****@trix.com>
| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| References: <01****************************@phx.gbl>
<Ch**************@cpmsftngxa06.phx.gbl>
| Subject: RE: fire button event programmatically
| Date: Tue, 29 Jul 2003 23:39:35 -0700
| Lines: 88
| Message-ID: <07****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNWZVcsxsK24TmkRNiO/8+BKduVCw==
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:163243
| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Lewis,
| It looks interesting but I thing something went lost
| during copy/paste, your code stops right when it starts
| to become interesting.
| Thanks
| >-----Original Message-----
| >Thanks, Steve for the suggestions.
| >
| >Carlo, here is a sample for your reference.
| >
| >WebForm1.aspx:
| >There is a href and a Button1[server control] on it.
| >
| ><a
| >href="javascript:test=window.open
| ('WebForm2.aspx','test','width=300,height=1
| >88');test.focus()">TEST</a>
| >
| >Button1'event:
| >
| >private void Button1_Click(object sender,
| System.EventArgs e)
| >{
| >Response.Write ("Button1_Clicked~!");
| >}
| >
| >WebForm2.aspx:
| >
| >Drag a Literal control and a Button1 from the Toolbox to
| the page.
| >
| >private void Button1_Click(object sender,
| System.EventArgs e)
| >{
| >string strjscript = "<script language='javascript'>alert
| ('fire');";
| > strjscript += "window.opener.Form1.Button1.click
| ();";
| >//Form1 is the default form name of WebForm1.aspx
| > strjscript += "</script" + ">";
| > Literal1.Text = strjscript;
| >}
| >
| >Please let me know if it meets your need. Thanks.
| >
| >Hope this helps
| >
| >Lewis
| >
| >This posting is provided "AS IS" with no warranties, and
| confers no rights.
| >
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "Carlo Marchesoni" <ca*****@trix.com>
| >| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| >| Subject: fire button event programmatically
| >| Date: Tue, 29 Jul 2003 11:12:20 -0700
| >| Lines: 6
| >| Message-ID: <01****************************@phx.gbl>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| Thread-Index: AcNV/PORCJM8aNh4SiaWEZ4VauLzTg==
| >| X-MimeOLE: Produced By Microsoft MimeOLE
| V5.50.4910.0300
| >| Newsgroups: microsoft.public.dotnet.framework.aspnet
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.framework.aspnet:163071
| >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| >| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| >|
| >| From an aspx page (A.aspx) I open another one (B.aspx -
| >| for table lookup). When the user selects an entry in
| >| B.aspx I would like to force a button's event in
| A.aspx
| >| to be fired. I guess the only way is using javascript -
|
| >| does anybody have a sample for this ?
| >| Thanks
| >|
| >
| >.
| >
|

Nov 17 '05 #3
Did you attach a file ? I just see 'here is a sample...'
and then WebForm1.aspx and WebForm1.aspx.cs but no
attachement and no reference to something else.
I don't understand.
Thanks for your help
-----Original Message-----
Hi Carlo,

Yes, you are right. It's not hard to fire a code-behind event fromjavascript.

Here is a sample to fire a code-behind event from javascript. It works fineon my side, you can try it on your side.

//when we click Button2, Button1's event will be fired from javascript.
WebForm1.aspx
WebForm1.aspx.cs

Check this link for more information:
<http://groups.google.com/groups? q=fire+an+event+javascript+yhhuang+click&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=xsSGTcBUDHA.2724% 40cpmsftngxa06.phx.gbl&rnum=1>

Please review my first post and you will know how to fire an event formanother page, thanks.

Does this answer your question? Please let me know if you need moreinformation.

Best Regards,
Lewis

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: "Carlo Marchesoni" <ca*****@trix.com>
| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| References: <01****************************@phx.gbl>
<Ch**************@cpmsftngxa06.phx.gbl>
<07****************************@phx.gbl>
<wP**************@cpmsftngxa06.phx.gbl>
| Subject: RE: fire button event programmatically
| Date: Wed, 30 Jul 2003 03:52:08 -0700
| Lines: 150
| Message-ID: <0b****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300| Thread-Index: AcNWiJ8cNpvbvIvxSYCetBeJ8RXIdw==
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:163297| NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Sorry that I still don't get it - the article is
| interesting and I manage to do it all, but this just
| shows how to load values in the window.opener (or at
| least that's what I understood). But I still don't see
| how you can fire a code-behind event. At the end the
| question probably is: how to fire code-behind event from| javascript.
| Thanks for your help
| >-----Original Message-----
| >Hi Carlo,
| >
| >Thank you for your reply.
| >
| >The sample in my previous reply is just a snippet for
| demonstration.
| >
| >I would also like to recommend one good article to you.| >http://aspnet.4guysfromrolla.com/articles/030202- 1.aspx| >
| >Please let me know if you need more information, thanks.| >
| >Best Regards
| >
| >Lewis
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "Carlo Marchesoni" <ca*****@trix.com>
| >| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| >| References: <019001c355fc$f39147d0 $a*******@phx.gbl>| ><Ch**************@cpmsftngxa06.phx.gbl>
| >| Subject: RE: fire button event programmatically
| >| Date: Tue, 29 Jul 2003 23:39:35 -0700
| >| Lines: 88
| >| Message-ID: <07****************************@phx.gbl>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MimeOLE: Produced By Microsoft MimeOLE
| V5.50.4910.0300
| >| Thread-Index: AcNWZVcsxsK24TmkRNiO/8+BKduVCw==
| >| Newsgroups: microsoft.public.dotnet.framework.aspnet
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.framework.aspnet:163243
| >| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| >| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet| >|
| >| Lewis,
| >| It looks interesting but I thing something went lost| >| during copy/paste, your code stops right when it
| starts
| >| to become interesting.
| >| Thanks
| >| >-----Original Message-----
| >| >Thanks, Steve for the suggestions.
| >| >
| >| >Carlo, here is a sample for your reference.
| >| >
| >| >WebForm1.aspx:
| >| >There is a href and a Button1[server control] on it.| >| >
| >| ><a
| >| >href="javascript:test=window.open
| >| ('WebForm2.aspx','test','width=300,height=1
| >| >88');test.focus()">TEST</a>
| >| >
| >| >Button1'event:
| >| >
| >| >private void Button1_Click(object sender,
| >| System.EventArgs e)
| >| >{
| >| >Response.Write ("Button1_Clicked~!");
| >| >}
| >| >
| >| >WebForm2.aspx:
| >| >
| >| >Drag a Literal control and a Button1 from the Toolbox| to
| >| the page.
| >| >
| >| >private void Button1_Click(object sender,
| >| System.EventArgs e)
| >| >{
| >| >string strjscript = "<script
| language='javascript'>alert
| >| ('fire');";
| >| > strjscript += "window.opener.Form1.Button1.click
| >| ();";
| >| >//Form1 is the default form name of WebForm1.aspx
| >| > strjscript += "</script" + ">";
| >| > Literal1.Text = strjscript;
| >| >}
| >| >
| >| >Please let me know if it meets your need. Thanks.
| >| >
| >| >Hope this helps
| >| >
| >| >Lewis
| >| >
| >| >This posting is provided "AS IS" with no warranties,| and
| >| confers no rights.
| >| >
| >| >
| >| >--------------------
| >| >| Content-Class: urn:content-classes:message
| >| >| From: "Carlo Marchesoni" <ca*****@trix.com>
| >| >| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| >| >| Subject: fire button event programmatically
| >| >| Date: Tue, 29 Jul 2003 11:12:20 -0700
| >| >| Lines: 6
| >| >| Message-ID: <019001c355fc$f39147d0 $a*******@phx.gbl>| >| >| MIME-Version: 1.0
| >| >| Content-Type: text/plain;
| >| >| charset="iso-8859-1"
| >| >| Content-Transfer-Encoding: 7bit
| >| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| >| Thread-Index: AcNV/PORCJM8aNh4SiaWEZ4VauLzTg==
| >| >| X-MimeOLE: Produced By Microsoft MimeOLE
| >| V5.50.4910.0300
| >| >| Newsgroups: microsoft.public.dotnet.framework.aspnet| >| >| Path: cpmsftngxa06.phx.gbl
| >| >| Xref: cpmsftngxa06.phx.gbl
| >| microsoft.public.dotnet.framework.aspnet:163071
| >| >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| >| >| X-Tomcat-NG:
| microsoft.public.dotnet.framework.aspnet
| >| >|
| >| >| From an aspx page (A.aspx) I open another one
| (B.aspx -
| >| >| for table lookup). When the user selects an entry| in
| >| >| B.aspx I would like to force a button's event in
| >| A.aspx
| >| >| to be fired. I guess the only way is using
| javascript -
| >|
| >| >| does anybody have a sample for this ?
| >| >| Thanks
| >| >|
| >| >
| >| >.
| >| >
| >|
| >
| >.
| >
|

Nov 17 '05 #4
That easy .... ! Thanks a million times, it works.
-----Original Message-----
Hi Carlo,

Yes, I attached two files in my prior post.

I will send them to your mailbox. If your mail address is invalid, pleasesend the correct one to me(remove "online") . Thanks.

Best Regards,
Lewis Wang

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: "Carlo Marchesoni" <ca*****@trix.com>
| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| References: <01****************************@phx.gbl>
<Ch**************@cpmsftngxa06.phx.gbl>
<07****************************@phx.gbl>
<wP**************@cpmsftngxa06.phx.gbl>
<0b****************************@phx.gbl>
<df**************@cpmsftngxa06.phx.gbl>
| Subject: RE: fire button event programmatically
| Date: Wed, 30 Jul 2003 09:58:08 -0700
| Lines: 236
| Message-ID: <0e****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300| Thread-Index: AcNWu8B2jmMFBxsnR9CnHhmhAAxTNg==
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:163444| NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Did you attach a file ? I just see 'here is a sample...'| and then WebForm1.aspx and WebForm1.aspx.cs but no
| attachement and no reference to something else.
| I don't understand.
| Thanks for your help
| >-----Original Message-----
| >Hi Carlo,
| >
| >Yes, you are right. It's not hard to fire a code- behind| event from
| >javascript.
| >
| >Here is a sample to fire a code-behind event from
| javascript. It works fine
| >on my side, you can try it on your side.
| >
| >//when we click Button2, Button1's event will be fired| from javascript.
| >
| >WebForm1.aspx
| >WebForm1.aspx.cs
| >
| >Check this link for more information:
| ><http://groups.google.com/groups?
| q=fire+an+event+javascript+yhhuang+click&hl
| >=en&lr=&ie=UTF-8&oe=UTF-8&selm=xsSGTcBUDHA.2724%
| 40cpmsftngxa06.phx.gbl&rnum=
| >1>
| >
| >Please review my first post and you will know how to
| fire an event form
| >another page, thanks.
| >
| >Does this answer your question? Please let me know if
| you need more
| >information.
| >
| >Best Regards,
| >Lewis
| >
| >This posting is provided "AS IS" with no warranties, and| confers no rights.
| >
| >
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "Carlo Marchesoni" <ca*****@trix.com>
| >| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| >| References: <019001c355fc$f39147d0 $a*******@phx.gbl>| ><Ch**************@cpmsftngxa06.phx.gbl>
| ><07****************************@phx.gbl>
| ><wP**************@cpmsftngxa06.phx.gbl>
| >| Subject: RE: fire button event programmatically
| >| Date: Wed, 30 Jul 2003 03:52:08 -0700
| >| Lines: 150
| >| Message-ID: <0b****************************@phx.gbl>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MIMEOLE: Produced By Microsoft MimeOLE
| V5.50.4910.0300
| >| Thread-Index: AcNWiJ8cNpvbvIvxSYCetBeJ8RXIdw==
| >| Newsgroups: microsoft.public.dotnet.framework.aspnet
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.framework.aspnet:163297
| >| NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
| >| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet| >|
| >| Sorry that I still don't get it - the article is
| >| interesting and I manage to do it all, but this just| >| shows how to load values in the window.opener (or at| >| least that's what I understood). But I still don't see| >| how you can fire a code-behind event. At the end the| >| question probably is: how to fire code-behind event
| from
| >| javascript.
| >| Thanks for your help
| >| >-----Original Message-----
| >| >Hi Carlo,
| >| >
| >| >Thank you for your reply.
| >| >
| >| >The sample in my previous reply is just a snippet for| >| demonstration.
| >| >
| >| >I would also like to recommend one good article to
| you.
| >| >http://aspnet.4guysfromrolla.com/articles/030202-
| 1.aspx
| >| >
| >| >Please let me know if you need more information,
| thanks.
| >| >
| >| >Best Regards
| >| >
| >| >Lewis
| >| >
| >| >--------------------
| >| >| Content-Class: urn:content-classes:message
| >| >| From: "Carlo Marchesoni" <ca*****@trix.com>
| >| >| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| >| >| References: <019001c355fc$f39147d0
| $a*******@phx.gbl>
| >| ><Ch**************@cpmsftngxa06.phx.gbl>
| >| >| Subject: RE: fire button event programmatically
| >| >| Date: Tue, 29 Jul 2003 23:39:35 -0700
| >| >| Lines: 88
| >| >| Message-ID: <070a01c35665$572f0210 $a*******@phx.gbl>| >| >| MIME-Version: 1.0
| >| >| Content-Type: text/plain;
| >| >| charset="iso-8859-1"
| >| >| Content-Transfer-Encoding: 7bit
| >| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| >| X-MimeOLE: Produced By Microsoft MimeOLE
| >| V5.50.4910.0300
| >| >| Thread-Index: AcNWZVcsxsK24TmkRNiO/8+BKduVCw==
| >| >| Newsgroups: microsoft.public.dotnet.framework.aspnet| >| >| Path: cpmsftngxa06.phx.gbl
| >| >| Xref: cpmsftngxa06.phx.gbl
| >| microsoft.public.dotnet.framework.aspnet:163243
| >| >| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| >| >| X-Tomcat-NG:
| microsoft.public.dotnet.framework.aspnet
| >| >|
| >| >| Lewis,
| >| >| It looks interesting but I thing something went
| lost
| >| >| during copy/paste, your code stops right when it
| >| starts
| >| >| to become interesting.
| >| >| Thanks
| >| >| >-----Original Message-----
| >| >| >Thanks, Steve for the suggestions.
| >| >| >
| >| >| >Carlo, here is a sample for your reference.
| >| >| >
| >| >| >WebForm1.aspx:
| >| >| >There is a href and a Button1[server control] on| it.
| >| >| >
| >| >| ><a
| >| >| >href="javascript:test=window.open
| >| >| ('WebForm2.aspx','test','width=300,height=1
| >| >| >88');test.focus()">TEST</a>
| >| >| >
| >| >| >Button1'event:
| >| >| >
| >| >| >private void Button1_Click(object sender,
| >| >| System.EventArgs e)
| >| >| >{
| >| >| >Response.Write ("Button1_Clicked~!");
| >| >| >}
| >| >| >
| >| >| >WebForm2.aspx:
| >| >| >
| >| >| >Drag a Literal control and a Button1 from the
| Toolbox
| >| to
| >| >| the page.
| >| >| >
| >| >| >private void Button1_Click(object sender,
| >| >| System.EventArgs e)
| >| >| >{
| >| >| >string strjscript = "<script
| >| language='javascript'>alert
| >| >| ('fire');";
| >| >| > strjscript += "window.opener.Form1.Button1.click| >| >| ();";
| >| >| >//Form1 is the default form name of WebForm1.aspx| >| >| > strjscript += "</script" + ">";
| >| >| > Literal1.Text = strjscript;
| >| >| >}
| >| >| >
| >| >| >Please let me know if it meets your need. Thanks.| >| >| >
| >| >| >Hope this helps
| >| >| >
| >| >| >Lewis
| >| >| >
| >| >| >This posting is provided "AS IS" with no
| warranties,
| >| and
| >| >| confers no rights.
| >| >| >
| >| >| >
| >| >| >--------------------
| >| >| >| Content-Class: urn:content-classes:message
| >| >| >| From: "Carlo Marchesoni" <ca*****@trix.com>
| >| >| >| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| >| >| >| Subject: fire button event programmatically
| >| >| >| Date: Tue, 29 Jul 2003 11:12:20 -0700
| >| >| >| Lines: 6
| >| >| >| Message-ID: <019001c355fc$f39147d0
| $a*******@phx.gbl>
| >| >| >| MIME-Version: 1.0
| >| >| >| Content-Type: text/plain;
| >| >| >| charset="iso-8859-1"
| >| >| >| Content-Transfer-Encoding: 7bit
| >| >| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| >| >| Thread-Index: AcNV/PORCJM8aNh4SiaWEZ4VauLzTg==
| >| >| >| X-MimeOLE: Produced By Microsoft MimeOLE
| >| >| V5.50.4910.0300
| >| >| >| Newsgroups:
| microsoft.public.dotnet.framework.aspnet
| >| >| >| Path: cpmsftngxa06.phx.gbl
| >| >| >| Xref: cpmsftngxa06.phx.gbl
| >| >| microsoft.public.dotnet.framework.aspnet:163071
| >| >| >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| >| >| >| X-Tomcat-NG:
| >| microsoft.public.dotnet.framework.aspnet
| >| >| >|
| >| >| >| From an aspx page (A.aspx) I open another one
| >| (B.aspx -
| >| >| >| for table lookup). When the user selects an
| entry
| >| in
| >| >| >| B.aspx I would like to force a button's event in| >| >| A.aspx
| >| >| >| to be fired. I guess the only way is using
| >| javascript -
| >| >|
| >| >| >| does anybody have a sample for this ?
| >| >| >| Thanks
| >| >| >|
| >| >| >
| >| >| >.
| >| >| >
| >| >|
| >| >
| >| >.
| >| >
| >|
|

.

Nov 17 '05 #5
Hi Carlo,

I am glad to hear that. :) Thanks very much for participating the community.

Best Regards,
Lewis

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "Carlo Marchesoni" <ca*****@trix.com>
| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| References: <01****************************@phx.gbl>
<Ch**************@cpmsftngxa06.phx.gbl>
<07****************************@phx.gbl>
<wP**************@cpmsftngxa06.phx.gbl>
<0b****************************@phx.gbl>
<df**************@cpmsftngxa06.phx.gbl>
<0e****************************@phx.gbl>
<s7**************@cpmsftngxa06.phx.gbl>
| Subject: RE: fire button event programmatically
| Date: Thu, 31 Jul 2003 05:21:35 -0700
| Lines: 303
| Message-ID: <59****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNXXkirlgpFq1oTQpG6ry/rcX8KHg==
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:163717
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| That easy .... ! Thanks a million times, it works.
| >-----Original Message-----
| >Hi Carlo,
| >
| >Yes, I attached two files in my prior post.
| >
| >I will send them to your mailbox. If your mail address
| is invalid, please
| >send the correct one to me(remove "online") . Thanks.
| >
| >Best Regards,
| >Lewis Wang
| >
| >This posting is provided "AS IS" with no warranties, and
| confers no rights.
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "Carlo Marchesoni" <ca*****@trix.com>
| >| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| >| References: <01****************************@phx.gbl>
| ><Ch**************@cpmsftngxa06.phx.gbl>
| ><07****************************@phx.gbl>
| ><wP**************@cpmsftngxa06.phx.gbl>
| ><0b****************************@phx.gbl>
| ><df**************@cpmsftngxa06.phx.gbl>
| >| Subject: RE: fire button event programmatically
| >| Date: Wed, 30 Jul 2003 09:58:08 -0700
| >| Lines: 236
| >| Message-ID: <0e****************************@phx.gbl>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MimeOLE: Produced By Microsoft MimeOLE
| V5.50.4910.0300
| >| Thread-Index: AcNWu8B2jmMFBxsnR9CnHhmhAAxTNg==
| >| Newsgroups: microsoft.public.dotnet.framework.aspnet
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.framework.aspnet:163444
| >| NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
| >| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| >|
| >| Did you attach a file ? I just see 'here is a
| sample...'
| >| and then WebForm1.aspx and WebForm1.aspx.cs but no
| >| attachement and no reference to something else.
| >| I don't understand.
| >| Thanks for your help
| >| >-----Original Message-----
| >| >Hi Carlo,
| >| >
| >| >Yes, you are right. It's not hard to fire a code-
| behind
| >| event from
| >| >javascript.
| >| >
| >| >Here is a sample to fire a code-behind event from
| >| javascript. It works fine
| >| >on my side, you can try it on your side.
| >| >
| >| >//when we click Button2, Button1's event will be
| fired
| >| from javascript.
| >| >
| >| >WebForm1.aspx
| >| >WebForm1.aspx.cs
| >| >
| >| >Check this link for more information:
| >| ><http://groups.google.com/groups?
| >| q=fire+an+event+javascript+yhhuang+click&hl
| >| >=en&lr=&ie=UTF-8&oe=UTF-8&selm=xsSGTcBUDHA.2724%
| >| 40cpmsftngxa06.phx.gbl&rnum=
| >| >1>
| >| >
| >| >Please review my first post and you will know how to
| >| fire an event form
| >| >another page, thanks.
| >| >
| >| >Does this answer your question? Please let me know if
| >| you need more
| >| >information.
| >| >
| >| >Best Regards,
| >| >Lewis
| >| >
| >| >This posting is provided "AS IS" with no warranties,
| and
| >| confers no rights.
| >| >
| >| >
| >| >
| >| >--------------------
| >| >| Content-Class: urn:content-classes:message
| >| >| From: "Carlo Marchesoni" <ca*****@trix.com>
| >| >| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| >| >| References: <019001c355fc$f39147d0
| $a*******@phx.gbl>
| >| ><Ch**************@cpmsftngxa06.phx.gbl>
| >| ><07****************************@phx.gbl>
| >| ><wP**************@cpmsftngxa06.phx.gbl>
| >| >| Subject: RE: fire button event programmatically
| >| >| Date: Wed, 30 Jul 2003 03:52:08 -0700
| >| >| Lines: 150
| >| >| Message-ID: <0b****************************@phx.gbl>
| >| >| MIME-Version: 1.0
| >| >| Content-Type: text/plain;
| >| >| charset="iso-8859-1"
| >| >| Content-Transfer-Encoding: 7bit
| >| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| >| X-MIMEOLE: Produced By Microsoft MimeOLE
| >| V5.50.4910.0300
| >| >| Thread-Index: AcNWiJ8cNpvbvIvxSYCetBeJ8RXIdw==
| >| >| Newsgroups: microsoft.public.dotnet.framework.aspnet
| >| >| Path: cpmsftngxa06.phx.gbl
| >| >| Xref: cpmsftngxa06.phx.gbl
| >| microsoft.public.dotnet.framework.aspnet:163297
| >| >| NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
| >| >| X-Tomcat-NG:
| microsoft.public.dotnet.framework.aspnet
| >| >|
| >| >| Sorry that I still don't get it - the article is
| >| >| interesting and I manage to do it all, but this
| just
| >| >| shows how to load values in the window.opener (or
| at
| >| >| least that's what I understood). But I still don't
| see
| >| >| how you can fire a code-behind event. At the end
| the
| >| >| question probably is: how to fire code-behind event
| >| from
| >| >| javascript.
| >| >| Thanks for your help
| >| >| >-----Original Message-----
| >| >| >Hi Carlo,
| >| >| >
| >| >| >Thank you for your reply.
| >| >| >
| >| >| >The sample in my previous reply is just a snippet
| for
| >| >| demonstration.
| >| >| >
| >| >| >I would also like to recommend one good article to
| >| you.
| >| >| >http://aspnet.4guysfromrolla.com/articles/030202-
| >| 1.aspx
| >| >| >
| >| >| >Please let me know if you need more information,
| >| thanks.
| >| >| >
| >| >| >Best Regards
| >| >| >
| >| >| >Lewis
| >| >| >
| >| >| >--------------------
| >| >| >| Content-Class: urn:content-classes:message
| >| >| >| From: "Carlo Marchesoni" <ca*****@trix.com>
| >| >| >| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| >| >| >| References: <019001c355fc$f39147d0
| >| $a*******@phx.gbl>
| >| >| ><Ch**************@cpmsftngxa06.phx.gbl>
| >| >| >| Subject: RE: fire button event programmatically
| >| >| >| Date: Tue, 29 Jul 2003 23:39:35 -0700
| >| >| >| Lines: 88
| >| >| >| Message-ID: <070a01c35665$572f0210
| $a*******@phx.gbl>
| >| >| >| MIME-Version: 1.0
| >| >| >| Content-Type: text/plain;
| >| >| >| charset="iso-8859-1"
| >| >| >| Content-Transfer-Encoding: 7bit
| >| >| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| >| >| X-MimeOLE: Produced By Microsoft MimeOLE
| >| >| V5.50.4910.0300
| >| >| >| Thread-Index: AcNWZVcsxsK24TmkRNiO/8+BKduVCw==
| >| >| >| Newsgroups:
| microsoft.public.dotnet.framework.aspnet
| >| >| >| Path: cpmsftngxa06.phx.gbl
| >| >| >| Xref: cpmsftngxa06.phx.gbl
| >| >| microsoft.public.dotnet.framework.aspnet:163243
| >| >| >| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| >| >| >| X-Tomcat-NG:
| >| microsoft.public.dotnet.framework.aspnet
| >| >| >|
| >| >| >| Lewis,
| >| >| >| It looks interesting but I thing something went
| >| lost
| >| >| >| during copy/paste, your code stops right when it
| >| >| starts
| >| >| >| to become interesting.
| >| >| >| Thanks
| >| >| >| >-----Original Message-----
| >| >| >| >Thanks, Steve for the suggestions.
| >| >| >| >
| >| >| >| >Carlo, here is a sample for your reference.
| >| >| >| >
| >| >| >| >WebForm1.aspx:
| >| >| >| >There is a href and a Button1[server control]
| on
| >| it.
| >| >| >| >
| >| >| >| ><a
| >| >| >| >href="javascript:test=window.open
| >| >| >| ('WebForm2.aspx','test','width=300,height=1
| >| >| >| >88');test.focus()">TEST</a>
| >| >| >| >
| >| >| >| >Button1'event:
| >| >| >| >
| >| >| >| >private void Button1_Click(object sender,
| >| >| >| System.EventArgs e)
| >| >| >| >{
| >| >| >| >Response.Write ("Button1_Clicked~!");
| >| >| >| >}
| >| >| >| >
| >| >| >| >WebForm2.aspx:
| >| >| >| >
| >| >| >| >Drag a Literal control and a Button1 from the
| >| Toolbox
| >| >| to
| >| >| >| the page.
| >| >| >| >
| >| >| >| >private void Button1_Click(object sender,
| >| >| >| System.EventArgs e)
| >| >| >| >{
| >| >| >| >string strjscript = "<script
| >| >| language='javascript'>alert
| >| >| >| ('fire');";
| >| >| >| > strjscript
| += "window.opener.Form1.Button1.click
| >| >| >| ();";
| >| >| >| >//Form1 is the default form name of
| WebForm1.aspx
| >| >| >| > strjscript += "</script" + ">";
| >| >| >| > Literal1.Text = strjscript;
| >| >| >| >}
| >| >| >| >
| >| >| >| >Please let me know if it meets your need.
| Thanks.
| >| >| >| >
| >| >| >| >Hope this helps
| >| >| >| >
| >| >| >| >Lewis
| >| >| >| >
| >| >| >| >This posting is provided "AS IS" with no
| >| warranties,
| >| >| and
| >| >| >| confers no rights.
| >| >| >| >
| >| >| >| >
| >| >| >| >--------------------
| >| >| >| >| Content-Class: urn:content-classes:message
| >| >| >| >| From: "Carlo Marchesoni" <ca*****@trix.com>
| >| >| >| >| Sender: "Carlo Marchesoni" <ca*****@trix.com>
| >| >| >| >| Subject: fire button event programmatically
| >| >| >| >| Date: Tue, 29 Jul 2003 11:12:20 -0700
| >| >| >| >| Lines: 6
| >| >| >| >| Message-ID: <019001c355fc$f39147d0
| >| $a*******@phx.gbl>
| >| >| >| >| MIME-Version: 1.0
| >| >| >| >| Content-Type: text/plain;
| >| >| >| >| charset="iso-8859-1"
| >| >| >| >| Content-Transfer-Encoding: 7bit
| >| >| >| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| >| >| >| Thread-Index: AcNV/PORCJM8aNh4SiaWEZ4VauLzTg==
| >| >| >| >| X-MimeOLE: Produced By Microsoft MimeOLE
| >| >| >| V5.50.4910.0300
| >| >| >| >| Newsgroups:
| >| microsoft.public.dotnet.framework.aspnet
| >| >| >| >| Path: cpmsftngxa06.phx.gbl
| >| >| >| >| Xref: cpmsftngxa06.phx.gbl
| >| >| >| microsoft.public.dotnet.framework.aspnet:163071
| >| >| >| >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| >| >| >| >| X-Tomcat-NG:
| >| >| microsoft.public.dotnet.framework.aspnet
| >| >| >| >|
| >| >| >| >| From an aspx page (A.aspx) I open another one
| >| >| (B.aspx -
| >| >| >| >| for table lookup). When the user selects an
| >| entry
| >| >| in
| >| >| >| >| B.aspx I would like to force a button's event
| in
| >| >| >| A.aspx
| >| >| >| >| to be fired. I guess the only way is using
| >| >| javascript -
| >| >| >|
| >| >| >| >| does anybody have a sample for this ?
| >| >| >| >| Thanks
| >| >| >| >|
| >| >| >| >
| >| >| >| >.
| >| >| >| >
| >| >| >|
| >| >| >
| >| >| >.
| >| >| >
| >| >|
| >|
| >
| >.
| >
|

Nov 17 '05 #6

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

Similar topics

9
by: HJ | last post by:
Hi all, I notice that the Form_Dirty event does not fire in Access 2002 (SP-1) when the first character is typed into a new record. In previous versions of Access it does fire. For existing...
2
by: Sam Miller | last post by:
Hi, I have a button event that won't fire. I left it on Friday and it worked fine. I came back in on Monday and it won't fire. I tried putting another button and just putting a...
2
by: Ofer | last post by:
I finally learned that DataGrid1.EditItemIndex = {row I want} -1 DataGrid1.DataBind() will make that row get to edit mode. I am stiil looking for ways to programticaly do other things: 1) show...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
5
by: Verde | last post by:
This is admittedly an apparently odd request... but please indulge me if you don't mind: Suppose I have two <asp:Button.../> on a page (Button1 and Button2). User clicks Button1 and triggers a...
15
by: Oleg Subachev | last post by:
I need to programmatically invoke from other class Click event of the Button on my Form. Button.OnClick method is protected, not public. How to perform this ? Oleg Subachev
4
by: Ty Salistean | last post by:
So, here is a wierd question that we have been discussing for a bit now. Does an event fire even though nothing is subscribed to listen to the event? For instance, does the Click event of a...
19
by: Daniela Roman | last post by:
Hello, I try to fire an event under a button click event and maybe anybody can give a clue please. I have let's say a WEB grid with PageIndexChanged event: private void...
4
by: Bob | last post by:
Hi, I'm working with VWD and i defined programmatically a button (in code-behind) with an ID. So I expect to see beside "Page Events" and "Form1" my button "b1" in order to use the Click event....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.