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. General Programming
  3. Visual Basic
  4. getting value of a textbox from a datagrid

getting value of a textbox from a datagrid

Scheduled Pinned Locked Moved Visual Basic
helpdesign
3 Posts 2 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.
  • U Offline
    U Offline
    uglyeyes
    wrote on last edited by
    #1

    Hi! I am having problem getting a textbox value once the user clicks a 'add button' below are my codes Protected Sub dgProdList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgProdList.ItemCommand If e.CommandName = "Add" Then Dim tbox As TextBox = CType(e.Item.FindControl("txtQty"), TextBox) in above tbox is empty and I dont know why its empty please help

    F 1 Reply Last reply
    0
    • U uglyeyes

      Hi! I am having problem getting a textbox value once the user clicks a 'add button' below are my codes Protected Sub dgProdList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgProdList.ItemCommand If e.CommandName = "Add" Then Dim tbox As TextBox = CType(e.Item.FindControl("txtQty"), TextBox) in above tbox is empty and I dont know why its empty please help

      F Offline
      F Offline
      Fu Manchu
      wrote on last edited by
      #2

      Well i'm gonna assume here.... i think this is because you may have forgot about the headers in your gridview/datagrid etc.. so you need to do this...

      If e.Item.ItemType <> ListItemType.Header Then

      Dim tbox As TextBox = CType(e.Item.FindControl("txtQty"), TextBox)
      

      End if

      Hope this helps! Andy

      U 1 Reply Last reply
      0
      • F Fu Manchu

        Well i'm gonna assume here.... i think this is because you may have forgot about the headers in your gridview/datagrid etc.. so you need to do this...

        If e.Item.ItemType <> ListItemType.Header Then

        Dim tbox As TextBox = CType(e.Item.FindControl("txtQty"), TextBox)
        

        End if

        Hope this helps! Andy

        U Offline
        U Offline
        uglyeyes
        wrote on last edited by
        #3

        sorry the fix was putting the ispostback on page load for databinding

        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