473,725 Members | 2,197 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fire button event programmaticall y

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 6820
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.asp x:
There is a href and a Button1[server control] on it.

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

Button1'even t:

private void Button1_Click(o bject sender, System.EventArg s e){
Response.Wri te ("Button1_Click ed~!");
}

WebForm2.asp x:

Drag a Literal control and a Button1 from the Toolbox to the page.
private void Button1_Click(o bject sender, System.EventArg s e){
string strjscript = "<script language='javas cript'>alert ('fire');"; strjscript += "window.opener. Form1.Button1.c lick ();";//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.c om>
| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| Subject: fire button event programmaticall y
| 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/PORCJM8aNh4SiaW EZ4VauLzTg==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Path: cpmsftngxa06.ph x.gbl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1630 71| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.c om>
| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| References: <01************ *************** *@phx.gbl>
<Ch************ **@cpmsftngxa06 .phx.gbl>
| Subject: RE: fire button event programmaticall y
| 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: AcNWZVcsxsK24Tm kRNiO/8+BKduVCw==
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Path: cpmsftngxa06.ph x.gbl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1632 43
| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.asp x:
| >There is a href and a Button1[server control] on it.
| >
| ><a
| >href="javascri pt:test=window. open
| ('WebForm2.aspx ','test','width =300,height=1
| >88');test.focu s()">TEST</a>
| >
| >Button1'even t:
| >
| >private void Button1_Click(o bject sender,
| System.EventArg s e)
| >{
| >Response.Wri te ("Button1_Click ed~!");
| >}
| >
| >WebForm2.asp x:
| >
| >Drag a Literal control and a Button1 from the Toolbox to
| the page.
| >
| >private void Button1_Click(o bject sender,
| System.EventArg s e)
| >{
| >string strjscript = "<script language='javas cript'>alert
| ('fire');";
| > strjscript += "window.opener. Form1.Button1.c lick
| ();";
| >//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.c om>
| >| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| >| Subject: fire button event programmaticall y
| >| 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/PORCJM8aNh4SiaW EZ4VauLzTg==
| >| X-MimeOLE: Produced By Microsoft MimeOLE
| V5.50.4910.0300
| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| Path: cpmsftngxa06.ph x.gbl
| >| Xref: cpmsftngxa06.ph x.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:1630 71
| >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.c s 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.asp x
WebForm1.aspx. cs

Check this link for more information:
<http://groups.google.com/groups? q=fire+an+event +javascript+yhh uang+click&hl=en&lr=&ie=U TF-8&oe=UTF-8&selm=xsSGTcBU DHA.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.c om>
| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| References: <01************ *************** *@phx.gbl>
<Ch*********** ***@cpmsftngxa0 6.phx.gbl>
<07*********** *************** **@phx.gbl>
<wP*********** ***@cpmsftngxa0 6.phx.gbl>
| Subject: RE: fire button event programmaticall y
| 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: AcNWiJ8cNpvbvIv xSYCetBeJ8RXIdw ==
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Path: cpmsftngxa06.ph x.gbl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1632 97| NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.c om>
| >| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| >| References: <019001c355fc$f 39147d0 $a*******@phx.g bl>| ><Ch*********** ***@cpmsftngxa0 6.phx.gbl>
| >| Subject: RE: fire button event programmaticall y
| >| 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: AcNWZVcsxsK24Tm kRNiO/8+BKduVCw==
| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| Path: cpmsftngxa06.ph x.gbl
| >| Xref: cpmsftngxa06.ph x.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:1632 43
| >| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.asp x:
| >| >There is a href and a Button1[server control] on it.| >| >
| >| ><a
| >| >href="javascri pt:test=window. open
| >| ('WebForm2.aspx ','test','width =300,height=1
| >| >88');test.focu s()">TEST</a>
| >| >
| >| >Button1'even t:
| >| >
| >| >private void Button1_Click(o bject sender,
| >| System.EventArg s e)
| >| >{
| >| >Response.Wri te ("Button1_Click ed~!");
| >| >}
| >| >
| >| >WebForm2.asp x:
| >| >
| >| >Drag a Literal control and a Button1 from the Toolbox| to
| >| the page.
| >| >
| >| >private void Button1_Click(o bject sender,
| >| System.EventArg s e)
| >| >{
| >| >string strjscript = "<script
| language='javas cript'>alert
| >| ('fire');";
| >| > strjscript += "window.opener. Form1.Button1.c lick
| >| ();";
| >| >//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.c om>
| >| >| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| >| >| Subject: fire button event programmaticall y
| >| >| Date: Tue, 29 Jul 2003 11:12:20 -0700
| >| >| Lines: 6
| >| >| Message-ID: <019001c355fc$f 39147d0 $a*******@phx.g bl>| >| >| 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/PORCJM8aNh4SiaW EZ4VauLzTg==
| >| >| X-MimeOLE: Produced By Microsoft MimeOLE
| >| V5.50.4910.0300
| >| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet| >| >| Path: cpmsftngxa06.ph x.gbl
| >| >| Xref: cpmsftngxa06.ph x.gbl
| >| microsoft.publi c.dotnet.framew ork.aspnet:1630 71
| >| >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| >| >| X-Tomcat-NG:
| microsoft.publi c.dotnet.framew ork.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.c om>
| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| References: <01************ *************** *@phx.gbl>
<Ch*********** ***@cpmsftngxa0 6.phx.gbl>
<07*********** *************** **@phx.gbl>
<wP*********** ***@cpmsftngxa0 6.phx.gbl>
<0b*********** *************** **@phx.gbl>
<df*********** ***@cpmsftngxa0 6.phx.gbl>
| Subject: RE: fire button event programmaticall y
| 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: AcNWu8B2jmMFBxs nR9CnHhmhAAxTNg ==
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Path: cpmsftngxa06.ph x.gbl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1634 44| NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Did you attach a file ? I just see 'here is a sample...'| and then WebForm1.aspx and WebForm1.aspx.c s 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.asp x
| >WebForm1.aspx. cs
| >
| >Check this link for more information:
| ><http://groups.google.com/groups?
| q=fire+an+event +javascript+yhh uang+click&hl
| >=en&lr=&ie=U TF-8&oe=UTF-8&selm=xsSGTcBU DHA.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.c om>
| >| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| >| References: <019001c355fc$f 39147d0 $a*******@phx.g bl>| ><Ch*********** ***@cpmsftngxa0 6.phx.gbl>
| ><07*********** *************** **@phx.gbl>
| ><wP*********** ***@cpmsftngxa0 6.phx.gbl>
| >| Subject: RE: fire button event programmaticall y
| >| 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: AcNWiJ8cNpvbvIv xSYCetBeJ8RXIdw ==
| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| Path: cpmsftngxa06.ph x.gbl
| >| Xref: cpmsftngxa06.ph x.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:1632 97
| >| NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
| >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.c om>
| >| >| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| >| >| References: <019001c355fc$f 39147d0
| $a*******@phx.g bl>
| >| ><Ch*********** ***@cpmsftngxa0 6.phx.gbl>
| >| >| Subject: RE: fire button event programmaticall y
| >| >| Date: Tue, 29 Jul 2003 23:39:35 -0700
| >| >| Lines: 88
| >| >| Message-ID: <070a01c35665$5 72f0210 $a*******@phx.g bl>| >| >| 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: AcNWZVcsxsK24Tm kRNiO/8+BKduVCw==
| >| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet| >| >| Path: cpmsftngxa06.ph x.gbl
| >| >| Xref: cpmsftngxa06.ph x.gbl
| >| microsoft.publi c.dotnet.framew ork.aspnet:1632 43
| >| >| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| >| >| X-Tomcat-NG:
| microsoft.publi c.dotnet.framew ork.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.asp x:
| >| >| >There is a href and a Button1[server control] on| it.
| >| >| >
| >| >| ><a
| >| >| >href="javascri pt:test=window. open
| >| >| ('WebForm2.aspx ','test','width =300,height=1
| >| >| >88');test.focu s()">TEST</a>
| >| >| >
| >| >| >Button1'even t:
| >| >| >
| >| >| >private void Button1_Click(o bject sender,
| >| >| System.EventArg s e)
| >| >| >{
| >| >| >Response.Wri te ("Button1_Click ed~!");
| >| >| >}
| >| >| >
| >| >| >WebForm2.asp x:
| >| >| >
| >| >| >Drag a Literal control and a Button1 from the
| Toolbox
| >| to
| >| >| the page.
| >| >| >
| >| >| >private void Button1_Click(o bject sender,
| >| >| System.EventArg s e)
| >| >| >{
| >| >| >string strjscript = "<script
| >| language='javas cript'>alert
| >| >| ('fire');";
| >| >| > strjscript += "window.opener. Form1.Button1.c lick| >| >| ();";
| >| >| >//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.c om>
| >| >| >| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| >| >| >| Subject: fire button event programmaticall y
| >| >| >| Date: Tue, 29 Jul 2003 11:12:20 -0700
| >| >| >| Lines: 6
| >| >| >| Message-ID: <019001c355fc$f 39147d0
| $a*******@phx.g bl>
| >| >| >| 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/PORCJM8aNh4SiaW EZ4VauLzTg==
| >| >| >| X-MimeOLE: Produced By Microsoft MimeOLE
| >| >| V5.50.4910.0300
| >| >| >| Newsgroups:
| microsoft.publi c.dotnet.framew ork.aspnet
| >| >| >| Path: cpmsftngxa06.ph x.gbl
| >| >| >| Xref: cpmsftngxa06.ph x.gbl
| >| >| microsoft.publi c.dotnet.framew ork.aspnet:1630 71
| >| >| >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| >| >| >| X-Tomcat-NG:
| >| microsoft.publi c.dotnet.framew ork.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.c om>
| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| 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 programmaticall y
| 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: AcNXXkirlgpFq1o TQpG6ry/rcX8KHg==
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Path: cpmsftngxa06.ph x.gbl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1637 17
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.c om>
| >| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| >| References: <01************ *************** *@phx.gbl>
| ><Ch*********** ***@cpmsftngxa0 6.phx.gbl>
| ><07*********** *************** **@phx.gbl>
| ><wP*********** ***@cpmsftngxa0 6.phx.gbl>
| ><0b*********** *************** **@phx.gbl>
| ><df*********** ***@cpmsftngxa0 6.phx.gbl>
| >| Subject: RE: fire button event programmaticall y
| >| 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: AcNWu8B2jmMFBxs nR9CnHhmhAAxTNg ==
| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| Path: cpmsftngxa06.ph x.gbl
| >| Xref: cpmsftngxa06.ph x.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:1634 44
| >| NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
| >| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| >|
| >| Did you attach a file ? I just see 'here is a
| sample...'
| >| and then WebForm1.aspx and WebForm1.aspx.c s 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.asp x
| >| >WebForm1.aspx. cs
| >| >
| >| >Check this link for more information:
| >| ><http://groups.google.com/groups?
| >| q=fire+an+event +javascript+yhh uang+click&hl
| >| >=en&lr=&ie=U TF-8&oe=UTF-8&selm=xsSGTcBU DHA.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.c om>
| >| >| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| >| >| References: <019001c355fc$f 39147d0
| $a*******@phx.g bl>
| >| ><Ch*********** ***@cpmsftngxa0 6.phx.gbl>
| >| ><07*********** *************** **@phx.gbl>
| >| ><wP*********** ***@cpmsftngxa0 6.phx.gbl>
| >| >| Subject: RE: fire button event programmaticall y
| >| >| 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: AcNWiJ8cNpvbvIv xSYCetBeJ8RXIdw ==
| >| >| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| >| >| Path: cpmsftngxa06.ph x.gbl
| >| >| Xref: cpmsftngxa06.ph x.gbl
| >| microsoft.publi c.dotnet.framew ork.aspnet:1632 97
| >| >| NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
| >| >| X-Tomcat-NG:
| microsoft.publi c.dotnet.framew ork.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.c om>
| >| >| >| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| >| >| >| References: <019001c355fc$f 39147d0
| >| $a*******@phx.g bl>
| >| >| ><Ch*********** ***@cpmsftngxa0 6.phx.gbl>
| >| >| >| Subject: RE: fire button event programmaticall y
| >| >| >| Date: Tue, 29 Jul 2003 23:39:35 -0700
| >| >| >| Lines: 88
| >| >| >| Message-ID: <070a01c35665$5 72f0210
| $a*******@phx.g bl>
| >| >| >| 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: AcNWZVcsxsK24Tm kRNiO/8+BKduVCw==
| >| >| >| Newsgroups:
| microsoft.publi c.dotnet.framew ork.aspnet
| >| >| >| Path: cpmsftngxa06.ph x.gbl
| >| >| >| Xref: cpmsftngxa06.ph x.gbl
| >| >| microsoft.publi c.dotnet.framew ork.aspnet:1632 43
| >| >| >| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| >| >| >| X-Tomcat-NG:
| >| microsoft.publi c.dotnet.framew ork.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.asp x:
| >| >| >| >There is a href and a Button1[server control]
| on
| >| it.
| >| >| >| >
| >| >| >| ><a
| >| >| >| >href="javascri pt:test=window. open
| >| >| >| ('WebForm2.aspx ','test','width =300,height=1
| >| >| >| >88');test.focu s()">TEST</a>
| >| >| >| >
| >| >| >| >Button1'even t:
| >| >| >| >
| >| >| >| >private void Button1_Click(o bject sender,
| >| >| >| System.EventArg s e)
| >| >| >| >{
| >| >| >| >Response.Wri te ("Button1_Click ed~!");
| >| >| >| >}
| >| >| >| >
| >| >| >| >WebForm2.asp x:
| >| >| >| >
| >| >| >| >Drag a Literal control and a Button1 from the
| >| Toolbox
| >| >| to
| >| >| >| the page.
| >| >| >| >
| >| >| >| >private void Button1_Click(o bject sender,
| >| >| >| System.EventArg s e)
| >| >| >| >{
| >| >| >| >string strjscript = "<script
| >| >| language='javas cript'>alert
| >| >| >| ('fire');";
| >| >| >| > strjscript
| += "window.opener. Form1.Button1.c lick
| >| >| >| ();";
| >| >| >| >//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.c om>
| >| >| >| >| Sender: "Carlo Marchesoni" <ca*****@trix.c om>
| >| >| >| >| Subject: fire button event programmaticall y
| >| >| >| >| Date: Tue, 29 Jul 2003 11:12:20 -0700
| >| >| >| >| Lines: 6
| >| >| >| >| Message-ID: <019001c355fc$f 39147d0
| >| $a*******@phx.g bl>
| >| >| >| >| 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/PORCJM8aNh4SiaW EZ4VauLzTg==
| >| >| >| >| X-MimeOLE: Produced By Microsoft MimeOLE
| >| >| >| V5.50.4910.0300
| >| >| >| >| Newsgroups:
| >| microsoft.publi c.dotnet.framew ork.aspnet
| >| >| >| >| Path: cpmsftngxa06.ph x.gbl
| >| >| >| >| Xref: cpmsftngxa06.ph x.gbl
| >| >| >| microsoft.publi c.dotnet.framew ork.aspnet:1630 71
| >| >| >| >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| >| >| >| >| X-Tomcat-NG:
| >| >| microsoft.publi c.dotnet.framew ork.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
4006
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 records that are being edited, the event does fire. Has this (previous) behaviour been changed by Microsoft?
2
3895
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 response.write on its click handler but it won't fire either telling me no button click events will fire. But my calendar control on the same page does fire. In the debugger I put a break point in the calendar event and the button
2
1511
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 the last page 2) fire select 3) fire delete 4) what is the last row in the last page
6
3379
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 the usual stuff of recreating the usercontrol in the Page Init event. The 'failure' sequence is as follows: - select web form button to display the user control - select user control button, event fires - select web form button to display...
5
10368
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 PostBack. How can I then fire the click event of Button2 during the same PostBack? I know this seems like a totally bad situation I'm creating out of naiveity. But please indulge. It would save me from having to provide a lengthy explanation for...
15
62089
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
5295
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 button fire even though nothing is subscribed to listen to the event. The answer is NO in a traditional Publisher/Subscriber design pattern (at least I think it is). I have stated that if nothing is subscribed, then the event never gets
19
4755
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 DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
4
8467
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. But it doesnt' appear. After saving the code-behind file, i only see "Page Events" and "Form1". If i define the button declarativally, i see it. But i need to define it programmatically. Can anybody tell me how to do? I also tried with...
0
8888
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
9401
Oralloy
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...
0
9257
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
9176
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,...
0
8097
agi2029
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...
0
6011
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
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
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.