ASP.net loop through GridView and gather Template column textbox values and tooltip

Murray Brown
Murray Brown used Ask the Experts™
on
Hi

I have an ASP.net Gridview that contains Template TextBox columns
I want to loop through and check the text box text and tooltip text
How do I do this in the following code? The sort of template columns are shown
below

            For i As Integer = 0 To Me.GridView1.Columns.Count - 1
                oColIndex = i + 2
                For r As Integer = 0 To Me.GridView1.Rows.Count - 1
                           'I need to gather the text box value and tooltip here
                Next r
            Next i

Open in new window


     <asp:TemplateField HeaderText="D1" Visible="false" ItemStyle-Wrap="true" >
                           <ItemTemplate>
                                <asp:Textbox ID="D1" runat="server"  Visible="true" Width="20"></asp:Textbox>
                           </ItemTemplate>
                      </asp:TemplateField>
                      <asp:TemplateField HeaderText="D2" Visible="false" ItemStyle-Wrap="true" >
                           <ItemTemplate>
                                <asp:Textbox ID="D2" runat="server"  Visible="true" Width="20" ></asp:Textbox>
                           </ItemTemplate>
                      </asp:TemplateField>
                     <asp:TemplateField HeaderText="D3" Visible="false" ItemStyle-Wrap="true">
                           <ItemTemplate>
                                <asp:Textbox ID="D3" runat="server"  Visible="true" Width="20" ></asp:Textbox>
                           </ItemTemplate>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Developer User Interface
Commented:
For Each gvRow As GridViewRow In dg1.Rows
    Dim txt1 As TextBox = CType(gvRow.FindControl("txt1"), TextBox)
    Dim strTextValue = txt1.Text
Next

Open in new window

Murray BrownASP.net/VSTO Developer

Author

Commented:
Thanks very much

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial