Version

AutoSubmit Property

Automatically submit form (postback to server) when control was clicked.
Syntax
'Declaration
 
Public Property AutoSubmit As Boolean
public bool AutoSubmit {get; set;}
Example
The AutoSubmit allows to enable or disable automatic submit of page when button is clicked. When AutoSubmit is true, then the
is used and page is submitted (posted to server) automatically when button recieves the "click" event. Automatic postback also may happen for some other events, like mouseup. It AutoSubmit is false, then the is used. In this case page is not submitted automatically, though, it is possible to process ClientSideEvents of button and trigger post back explicitly.

' Example to trigger postback manually.
Me.WebImageButton1.AutoSubmit = False
Me.WebImageButton1.ClientSideEvents.Click = "clickButton1"

' Below are codes in aspx (or any other script file loaded to client)

<script language="javascript">

// function called before WebImageButton1 gets the click event
function clickButton1(oButton, oEvent)
{
	// Trigger postback only if button was clicked by mouse
	if(oEvent.action == "0")
		oEvent.needPostBack = true;
	// Next line would trigger post back on any click event (Space, Enter, AccessKey)
	//oEvent.needPostBack = true;
}
</script>
// Example to trigger postback manually.
this.WebImageButton1.AutoSubmit = false;
this.WebImageButton1.ClientSideEvents.Click = "clickButton1";

// Below are codes in aspx (or any other script file loaded to client)

<script language="javascript">

// function called before WebImageButton1 gets the click event
function clickButton1(oButton, oEvent)
{
	// Trigger postback only if button was clicked by mouse
	if(oEvent.action == "0")
		oEvent.needPostBack = true;
	// Next line would trigger post back on any click event (Space, Enter, AccessKey)
	//oEvent.needPostBack = true;
}
</script>
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also