How to call an event from another procedure?

J

Jason

I have an ASP.NET application in which I would like to call my button click
event on the page load if certain criteria are met.

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
 
B

Bob Barrows [MVP]

Jason said:
I have an ASP.NET application in which I would like to call my button
click event on the page load if certain criteria are met.

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

There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-savvy person here who can
answer your question, you can eliminate the luck factor by posting your
question to a newsgroup where the dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.

However:

I think your best course of action is to create a sub that does the work
required when that button is clicked. Replace the code in the
imgSubmitSearch_Click sub with a call to the new sub. Then simply call that
new sub in Page_Load when required.

Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top