P
Paul
Example: I have a ASP.NET project called TestApp written in c#. It has
WebForm1.aspx/WebForm1.aspx.cs. There is a button click event for
Button 1. It updates a label on the form. The code for the
Button1_Click is:
private void Button1_Click(object sender, System.EventArgs e)
{
this.Label1.Text = "Button was clicked";
}
What I would like to be able to do is in a class file, be able to do
something like:
namespace TestApp
{
class WebForm1
{
private override Button1_Click(object sender, System.EventArgs e)
{
this.Label1.Text = "My class, not the form, updated this label.";
}
}
}
The only way I can explain it is hooking into a function and overriding
it to do what I want. Does this make any sense? Can this be done?
Thanks in advance.
Paul
WebForm1.aspx/WebForm1.aspx.cs. There is a button click event for
Button 1. It updates a label on the form. The code for the
Button1_Click is:
private void Button1_Click(object sender, System.EventArgs e)
{
this.Label1.Text = "Button was clicked";
}
What I would like to be able to do is in a class file, be able to do
something like:
namespace TestApp
{
class WebForm1
{
private override Button1_Click(object sender, System.EventArgs e)
{
this.Label1.Text = "My class, not the form, updated this label.";
}
}
}
The only way I can explain it is hooking into a function and overriding
it to do what I want. Does this make any sense? Can this be done?
Thanks in advance.
Paul