A
AidanT
I am writing my first Web application, and have a question regarding
asp Buttons of Submit and Command Type.
I have a WebForm with a Command Button on it that I am creating in the
Page_Load :
....
// ADD Button
Button cmdAdd = new Button();
cmdAdd.Text = "Add";
cmdAdd.CommandName = "Add";
cmdAdd.CommandArgument="AddLine";
cmdAdd.Command += new CommandEventHandler ( HandleButtonPressed );
....
When the button is pressed I want it to be handled in a delegate like
this :
....
private void HandleButtonPressed ( object sender, CommandEventArgs e)
{
// handle stuff here - I add a row to a Table
}
....
However, the first time I press the button this method is called as I
want, and the next time the Button seems to do a Submit without
calling my event handler. Is it possible to combine the two, so that I
press the button, perform my action in the Command Event Handler and
refresh my WebForm with the changes in my action?
asp Buttons of Submit and Command Type.
I have a WebForm with a Command Button on it that I am creating in the
Page_Load :
....
// ADD Button
Button cmdAdd = new Button();
cmdAdd.Text = "Add";
cmdAdd.CommandName = "Add";
cmdAdd.CommandArgument="AddLine";
cmdAdd.Command += new CommandEventHandler ( HandleButtonPressed );
....
When the button is pressed I want it to be handled in a delegate like
this :
....
private void HandleButtonPressed ( object sender, CommandEventArgs e)
{
// handle stuff here - I add a row to a Table
}
....
However, the first time I press the button this method is called as I
want, and the next time the Button seems to do a Submit without
calling my event handler. Is it possible to combine the two, so that I
press the button, perform my action in the Command Event Handler and
refresh my WebForm with the changes in my action?