VB .NET: How to extract the value of a textbox in a GridView TemplateField?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • k3nz0
    New Member
    • Feb 2009
    • 2

    VB .NET: How to extract the value of a textbox in a GridView TemplateField?

    Hi All,

    I have a GridView and inside this GridView I only have one TemplateField. Inside this TemplateField, I have plenty of textboxes. Values of these textboxes are extracted from the database.

    One of the textboxes is called txt_CarFeatures (this is the ID). Value of this textbox is extracted from the database, using Bind("CarFeatur es"). There is no problem populating the value into the textbox.

    My problem is how to get the value from the textbox.
    I am trying to get the value from this txt_CarFeatures textbox and use it for something else.
    For example: after getting populated, txt_CarFeatures has "abcd123" in it. I am trying to get this "abcd123" and use it for something else.

    I did some research and found some information about FindControl. But I have no idea how to use it and not sure whether this is the solution.

    Please advise. Thanks.
    Last edited by Frinavale; Mar 2 '09, 03:14 PM. Reason: Moved to ASP.NET Answers from VB.NET
  • k3nz0
    New Member
    • Feb 2009
    • 2

    #2
    Resolved. I used the following:
    Code:
    Dim test As TextBox test= CType(gridView_SearchResultDetails.Rows(0).Cells(0).FindControl("txt_Test1"), TextBox)
    Hope this is useful for those who have similar issue.
    Last edited by Frinavale; Mar 2 '09, 03:14 PM. Reason: Added [code] tags: Please post code in [code] [/code] tags

    Comment

    Working...