Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. lost focus event in textbox

lost focus event in textbox

Scheduled Pinned Locked Moved ASP.NET
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Girish481
    wrote on last edited by
    #1

    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

    D S A 3 Replies Last reply
    0
    • G Girish481

      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

      D Offline
      D Offline
      DoctorMick
      wrote on last edited by
      #2

      You're trying to call a server side event with client script by the looks of it. Try learning about Ajax.

      1 Reply Last reply
      0
      • G Girish481

        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

        S Offline
        S Offline
        SayreCC
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • G Girish481

          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

          A Offline
          A Offline
          AlexeiXX3
          wrote on last edited by
          #4

          use this code:

          Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
          myfunc()
          End Sub

          Remove the code in you page load and set the textbox autopostback = true

          Alexei Rodriguez

          G 1 Reply Last reply
          0
          • A AlexeiXX3

            use this code:

            Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
            myfunc()
            End Sub

            Remove the code in you page load and set the textbox autopostback = true

            Alexei Rodriguez

            G Offline
            G Offline
            Girish481
            wrote on last edited by
            #5

            Your solution worked for me. Thank you Alexei Rodriguez!!! Regards Girish Sharma

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups