Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 424
  • Last Modified:

Capture Textbox Value in GridView

I've created a GridView with a TextBox in the Grid for each column.
What I have:

Checkbox:    Name:    Textbox
       x              Jeff      ----------

Submit Button:
What I want to do:

I want to input a value into the TextBox and click submit and have this information save to a database. I know how to save etc; . What I can't get is capturing the TextBox value. This is what I'm doing and works for the column 1. Since the textbox is a template field and not part of the Grid I need to know how to grab the value for each line entered. I've provided my code what I have. It grabs column 1 but not column 2 (Textbox)

Any suggestions,. Thanks

Protected Sub chkbox_changed(ByVal sender As Object, ByVal e As EventArgs)
        Dim chkTest As CheckBox = DirectCast(sender, CheckBox)
        Dim grdRow As GridViewRow = DirectCast(chkTest.NamingContainer, GridViewRow)

        'This will Dim the string and provide an output of the parameter in the table. This is an output from the Stored Procedure sp_LOV_Notes_Load
        Dim Col1 As String = grdRow.Cells(1).Text 'Captures Project
        Dim Col2 As String = grdRow.Cells(2).Text 'Captures Time Spent

    End Sub

Open in new window

1 Solution
jeffreyjseamanAuthor Commented:
CodeProject worked for me. Tried it out and bingo perfect. Thank You

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now