Action Property
Gets or sets the URL to which the form is submitted. The default value is an empty string ("").
public string Action {
get,
set
}
Remarks
The default value, an empty string (""), causes postbacks to the same URL. You can override the default value to generate forms that submit data to a second URL, rather than back to the same URL.
Note If the Action property is inherited, the Command control does not post back to the same URL, but instead posts form contents to the second URL.
Example
The following example demonstrates how to use the Action property of a form to set the URL where the form is submitted. The method of submitting the form depends on the Method property of the form. By default, it is a Post method.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Somepage.aspx must be present in same directory
Form1.Action = "Somepage.aspx"
End Sub
[C#]
private void Page_Load(object sender, System.EventArgs e)
{
// Somepage.aspx must be present in same directory.
Form1.Action = "Somepage.aspx";
}
See Also
Applies to: Form Class