Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0VB .NET: How to extract the value of a textbox in a GridView TemplateField?VB .NET: How to extract the value of a textbox in a GridView TemplateField?
Previous
 
Next
New Post
2/25/2009 8:43 AM
 

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("CarFeatures"). 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.

 
New Post
2/25/2009 9:53 AM
 

I have always used findcontrol.  Here is an example:

Dim Car_Features As Textbox= CType(e.Item.FindControl("CarFeatures"), Textbox)

 

Hope this helps

 
New Post
2/25/2009 7:43 PM
 
Hi Joe,

Thanks for the response.
What is "e" referring to?
Anyway I tried your solution with a slight modification since I couldn't figure out what "e" is. Here's what I did:

Dim Car_Features As Textbox= CType(gridview_Details.FindControl("txt_CarFeatures"), Textbox)
Dim test as String

test = Car_Features.Text

It returned the following error:
Object reference not set to an instance of an object.

For your info, gridview_Details is the ID of the GridView.
 
New Post
2/26/2009 5:21 AM
 
Resolved. I used the following: 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.
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0VB .NET: How to extract the value of a textbox in a GridView TemplateField?VB .NET: How to extract the value of a textbox in a GridView TemplateField?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out