Iterating through a Repeater Control - Loosing my mind...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dim i As Integer

Dim Collected1 As TextBox

For i = 0 To (Grid.Items.Count - 1)

Collected1 = CType(Grid.Items(i).FindControl("COLLECTED"), TextBox)

Response.Write(Collected1.Text)

Next

This doesn't work and prints nothing even though data is in the textbox.
Any ideas - this is driving me mad...
 
Hi,
Try this code:
foreach (GridViewRow row in GridView1.Rows)
{

// Selects the text from the TextBox which is inside the GridView control

string textBoxText = ((TextBox)row.FindControl("TextBox1")).Text;

Response.Write(textBoxText);

}
Although the above code is in C# you can easily convert it to VB.NET
Whenever i have query regarding gridview i refer site
http://gridviewguy.com/CategoryDetails.aspx?categoryID=7
 
Back
Top