lost focus event in textbox
-
On the page load event i have coded this: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load TextBox1.Attributes.Add("onblur", "return myfunc()") End Sub Public Sub myfunc() Dim dataset1 as new dataset Dim da as new dataadapter .. .. TextBox1.Text = "This is lostfocus." End Sub but it is not working. In the myfunc() i would like to code connection string, data adapter and dataset to go further. Kindly tell me how call a function/procedure which is wirtten in file.aspx.vb on lost focus of textbox. Thanks & Regards Girish Sharma
-
On the page load event i have coded this: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load TextBox1.Attributes.Add("onblur", "return myfunc()") End Sub Public Sub myfunc() Dim dataset1 as new dataset Dim da as new dataadapter .. .. TextBox1.Text = "This is lostfocus." End Sub but it is not working. In the myfunc() i would like to code connection string, data adapter and dataset to go further. Kindly tell me how call a function/procedure which is wirtten in file.aspx.vb on lost focus of textbox. Thanks & Regards Girish Sharma
You're trying to call a server side event with client script by the looks of it. Try learning about Ajax.
-
On the page load event i have coded this: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load TextBox1.Attributes.Add("onblur", "return myfunc()") End Sub Public Sub myfunc() Dim dataset1 as new dataset Dim da as new dataadapter .. .. TextBox1.Text = "This is lostfocus." End Sub but it is not working. In the myfunc() i would like to code connection string, data adapter and dataset to go further. Kindly tell me how call a function/procedure which is wirtten in file.aspx.vb on lost focus of textbox. Thanks & Regards Girish Sharma
Hi, to call function, first the function must be public if you want to use it to other project or webform. About your Code to call the procedure myfunc() example in your button1 click event you can insert button1_click() { myfunc(); }
Hope this one can help. Thanks Hi, Please select Good Question if my answer are fit to your Question.
-
On the page load event i have coded this: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load TextBox1.Attributes.Add("onblur", "return myfunc()") End Sub Public Sub myfunc() Dim dataset1 as new dataset Dim da as new dataadapter .. .. TextBox1.Text = "This is lostfocus." End Sub but it is not working. In the myfunc() i would like to code connection string, data adapter and dataset to go further. Kindly tell me how call a function/procedure which is wirtten in file.aspx.vb on lost focus of textbox. Thanks & Regards Girish Sharma
-
use this code:
Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
myfunc()
End SubRemove the code in you page load and set the textbox autopostback = true
Alexei Rodriguez