Capture Textbox Value in GridView

Posted on 2009-12-30
Last Modified: 2012-05-08
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

Question by:jeffreyjseaman
    LVL 11

    Expert Comment

    LVL 10

    Accepted Solution


    Author Closing Comment

    CodeProject worked for me. Tried it out and bingo perfect. Thank You

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now