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.

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.