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

Template column to do multiple insert...

I have a template column called "Results".  A textbox is inserted in every cell in the "Results" column.  The number of rows will vary upon what the search parameters were.  I am having a TERRIBLE time understanding how to take the values entered into the textboxes in each row, and insert that data into the table.  This is not an update of existing data, I am inserting new rows.  There may be 7 rows, 10 rows, it varies.  Here is an example of what the datagrid may look like on a runned query by the user:

Test             Test Item             Units             Results               Min            Max

67           ;aksd;ksd;askdf;s      ppm            |____6.5___|         6.5            7.5
45           ;akd;falksd;lskd;s      ppm            |____6.5___|         6.5            7.5
3             ;alksd;alkd;slk;s;      ppm             |____6.5___|         6.5            7.5
12           ;aslkd;askldf;asd       ppm            |___6.5____|         6.5            7.5
8             ;askdf;asldkf;asd      ppm             |___6.5____|         6.5            7.5

This |_______| represents the textboxes.  I entered the values "6.5" for examples.  I would like the user to click perhaps a "Save" button and this information is inserted into the table.  I'm just not sure how to "find" the entered values in these textboxes.  

The ID of the textbox in asp.net is "txtResult".  I program in VB.net.  I have spent too much time on trying to figure this out myself as I'm getting more and more confused.  What I'm looking for is a good example of how to do this, with as easy as it can get instructions.  I have read sooooooooo many articles, etc but for some reason I just can't grasp this.  Thanks in advance!!!
1 Solution
This help?, it will iterate through all the rows in the datagrid.

Private Sub btnSave_Click(...)
  For each dgi as DataGridItem in myDataGrid.Items
    If dgi.ItemType <> ListItemType.Header and dgi.ITemType <> ListItemType.Footer Then
      Dim t as TextBox = Directcast(dgi.FindControl("myTextBoxIDinTemplateColumn"), Textbox)
      dosomething = t.Text
    end if
  End If
End Sub

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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