Template column to do multiple insert...

Posted on 2005-05-12
Last Modified: 2010-08-05
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 is "txtResult".  I program in  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!!!
Question by:johnqtr
    1 Comment
    LVL 33

    Accepted 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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    759 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

    11 Experts available now in Live!

    Get 1:1 Help Now