Hi Jason,
How are you doing on this question or does our reply help you a little? If
there're anything else we can help, please feel free to post here.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 104847050
| References: <
[email protected]>
<#
[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Thu, 22 Dec 2005 06:30:09 GMT
| Subject: Re: Calling an event procedure from page load
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| Message-ID: <
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Lines: 73
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:366489
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi Jason,
|
| As Peter has mentioned, you can assign the two parameters(source and e)
| yourself, e.g:
|
| our function ()
| {
|
| btnTest_Click( this, EventArgs.Empty);
| }
|
|
| Also, for your scenario, you need to let some of your code logic be
| executable through both ASP.NET page's User interface(interactively) and
| your own code logic (programmatically), I think it'll be better you
| separate those code into a new function. e.g:
|
| btnTest_Click(object source, EventArgs e)
| {
| btnTest_Click_Function();
| }
|
|
| thus, you can just call the "btnTest_Click_Function" in other place where
| you want to programmatically execute those code logic...
|
| Hope helps. Thanks,
|
| Regards,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure!
www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
| --------------------
| | From: "Peter Rilling" <
[email protected]>
| | References: <
[email protected]>
| | Subject: Re: Calling an event procedure from page load
| | Date: Wed, 21 Dec 2005 08:24:28 -0800
| | Lines: 27
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| | X-RFC2646: Format=Flowed; Original
| | Message-ID: <#
[email protected]>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | NNTP-Posting-Host: p200.loudeye.com 64.85.69.200
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
| | Xref: TK2MSFTNGXA02.phx.gbl
| microsoft.public.dotnet.framework.aspnet:366285
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | Well, since you can call any method, an event method is no exception.
| You
| | just have to provide the arguments yourself. So if you do not need the
| "e"
| | argument, then maybe just pass a nothing.
| |
| | Calling an event handler directly is usually a bad idea. A better
design
| | would be to determine what in the handler you want to reuse and place
the
| | code in its own method that both the ..._Click and Page_Load event can
| call.
| |
| | | | >I have an ASP.NET application in which I would like to call my button
| click
| | > event (imgSubmitSearch_Click) on the page load if certain criteria
are
| | > met.
| | > Is this possible?
| | >
| | > What is the correct syntax to be able to programmatically have my
| | > imgSubmitSearch button clicked? I tried the obvious, Call
| | > imgSubmitSearch,
| | > but intellisense doesn't like that due to the sender / e arguments.
| | >
| | > Private Sub imgSubmitSearch_Click(ByVal sender As System.Object,
ByVal
| e
| | > As
| | > System.Web.UI.ImageClickEventArgs) Handles imgSubmitSearch.Click
| | >
| | >
| |
| |
| |
|
|