Causing an ASP.Net PostBack from one control to another on the client side :)


Here's the scenario. You want the OnBlur client side JavaScript event to fire a PostBack as if it were another button on the page being clicked. Here's an example of how to accomplish this:

Dim eventHandler As String = Me.Page.ClientScript.GetPostBackEventReference(btnValidate, "")
txtUsername.Attributes.Add("onblur", eventHandler)

In this above the whenever forus is lost on the txtUsername text box a PostBack will be made as if it's coming from the btnValidate's click event.