Share via


Method Property (Form)

Sets or returns the method used to submit the form. The default value is post.

public System.Web.UI.MobileControls.FormMethod Method {
   get,
   set
}

Remarks

is limited in the amount of data it can post. Some types of postbacks might fail when using a get parameter? request. The advantage of a get request is that all the parameters are specified as part of the URL, and the URL can thus be cached or saved.

Example

The following example demonstrates how to use the Method property of the Form class.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   If Not IsPostBack
        Form1.Method = FormMethod.Post
   End If
End Sub

[C#]

private void Page_Load(object sender, System.EventArgs e)
{
  if(!IsPostBack)
  {
    Form1.Method = FormMethod.Post;
  }
}

See Also

Applies to: Form Class