2
Answers

bind user input from column to gridview

michael creek

michael creek

15y
4.1k
1
gridview has  columns
1st column is quantity
2nd column is unit cost
3rd column is total (quantity * unit cost)

user enters all items
how do i bind the 3rd column to the gridview

Answers (2)
0
michael creek

michael creek

NA 3 0 15y
thanks for your reponse,

I can get the values in the code behind using:
TextBox r1c7 = (TextBox)row.Cells[5].FindControl("txtamount"); for example

but how do I set the Text value in the asp.net, i.e.,
Text='<%# Bind("[whatgoeshere]") %>'>
0
Roei Bar

Roei Bar

NA 7.8k 0 15y
i think this is what you are looking for

 protected void GDVDates_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex < 0) return; // when e.Row.RowIndex is -1, it`s HeaderText
e.Row.Cells[3].Text = Convert.ToInt32(e.Row.Cells[1].Text).ToString() + " - " + Convert.ToInt32(e.Row.Cells[2].Text).ToString();
e.Row.Cells[1].Text = Convert.ToInt32(e.Row.Cells[1].Text).ToString();
e.Row.Cells[2].Text = Convert.ToInt32(e.Row.Cells[2].Text).ToString();
}