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

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!
 
A

amandag

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
}
}
}
 
C

Cirene

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
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top