Need suggestion: How to process input for multiple rows in gridview

  • Thread starter Thread starter Cirene
  • Start date Start date
C

Cirene

I have a simple, 3 column, databound gridview that is laid out like this...
QTY (textbox for input), PRODUCT, PRICING

The user can input a quantity for 1 or more items in the gridview.

When they hit submit how can I loop thru the gridview and check what they
entered for QTY?

I need to get a list like this....
1, PRODUCT 1, $1.40
4, PRODUCT 8, $10.47
2, PRODUCT 10, $1.42

Thanks!
 
protected void btnSubmit_Click(object sender, EventArgs e)
{
TextBox t;
foreach (GridViewRow grv in GridView1.Rows)
{
t = grv.FindControls("yourTextBoxId") as TextBox;
if (t != null)
{
//t.Text
}
}
}
 
Thanks I'll give it a try!
amandag said:
protected void btnSubmit_Click(object sender, EventArgs e)
{
TextBox t;
foreach (GridViewRow grv in GridView1.Rows)
{
t = grv.FindControls("yourTextBoxId") as TextBox;
if (t != null)
{
//t.Text
}
}
}
 
Back
Top