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

Call an event handler programatically

Hi,

I have an asp button name btnSubmit in a web form

Here is the event handler declaration:
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

How can I call this sub programatically? Of course I can just insert one
line of code with the Sub name, but what sender and e should I use?

TIA
Nov 19 '05 #1
3 1486
"=?Utf-8?B?RWQgQ2hpdQ==?=" <Ed****@discussions.microsoft.com> wrote in
news:7B**********************************@microsof t.com:
Hi,

I have an asp button name btnSubmit in a web form

Here is the event handler declaration:
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

How can I call this sub programatically? Of course I can just insert one
line of code with the Sub name, but what sender and e should I use?

You can use "nothing"

btnsubmit_click(nothing, nothing)

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.

Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com
Nov 19 '05 #2
how about instead you put in a function in the btn event that you call, then
you can call that function from anywhere, anytime.... without worrying about
the button's events.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Ed Chiu" wrote:
Hi,

I have an asp button name btnSubmit in a web form

Here is the event handler declaration:
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

How can I call this sub programatically? Of course I can just insert one
line of code with the Sub name, but what sender and e should I use?

TIA

Nov 19 '05 #3
I agree. It is generally a bad practice to call a handler directly.

"Curt_C [MVP]" <software_at_darkfalz.com> wrote in message
news:76**********************************@microsof t.com...
how about instead you put in a function in the btn event that you call,
then
you can call that function from anywhere, anytime.... without worrying
about
the button's events.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Ed Chiu" wrote:
Hi,

I have an asp button name btnSubmit in a web form

Here is the event handler declaration:
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

How can I call this sub programatically? Of course I can just insert one
line of code with the Sub name, but what sender and e should I use?

TIA

Nov 19 '05 #4

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

Similar topics

3
by: JoeK | last post by:
Hey all, I am automating a web page from Visual Foxpro. I can control all the textboxes, radio buttons, and command buttons using syntax such as: ...
1
by: mg | last post by:
In a Web Form, I have a TextBox: protected System.Web.UI.WebControls.TextBox TextBox1; At design time, I double click on the TextBox and get an event handler: private void...
7
by: mg | last post by:
How can I call an event handler (e.g., Button1_Click) programmatically. That is, without having to click on the button with the mouse.
2
by: jorge | last post by:
Hello I have the following situation: (everything is dynamic (controls.add)) 1. Button.Init { WasButtonClickFired = true } 2. TextBox.TextChanged { WasButtonClickFired?
1
by: Laurent Bugnion | last post by:
Hi, I am trying to programatically add an "onunload" event handler to the "body" tag of an ASPX page. I am doing this from a Custom Control located on this page. To do this, I added...
3
by: lauralucas | last post by:
Hi I'm creating controls programatically. On postback, the events of the controls are not triggered correctly. I need to not only rebind the controls to their datasource on every load, but...
2
by: luisxx | last post by:
WinSrv2003 SP1 IIS 6.0 ASP.NET C#, 2.0 SQL 2005 All on same machine Hello everyone! I have a method in ASP.NET 2.0 that I can't seem to get right, Gridview1_rowcommand.
6
by: Kevin Attard | last post by:
I am using a GridView inside a UserControl which has a template column for deleting the rows. Before databinding the gridview i am attaching the RowCommand and RowDataBound event. I am using the...
8
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.