Monday, February 22, 2010

To Fire OnBlur Event of Textbox on Sever Side

I will show in this post a simple method to fire onBlur Event of a textbox in server side, this can be used to check the value in textbox with the database, like to validate the data if already exist

put a server side button in the page and hide the button with div having style display none so that it is not triggered by clicking event
In page load
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim eventhandler As String = Me.ClientScript.GetPostBackEventReference(Me.btnLoad, "")
Me.TextName.Attributes.Add("onblur", eventhandler)

End Sub


Write your process in the button click event
Protected Sub btnLoad_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLoad.Click
‘Put your Own Code’
End Sub

No comments:

Post a Comment