I am currently doing data binding with a grid view with a data source from an ArrayList. Is there a way to reverse the bind and get the value from the grid view with a one line code?
// Bind to GUI
ArrayList dsList;
gvName.DataSource = dsList;
gvName.DataBind();
// Current Way of getting code from GUI
int iRow = 0;
foreach (GridViewRow gvr in gvName.Rows)
{
TextBox txtD1 = gvName.FindControl("textboxName") as TextBox;
if (txtD1 != null)
{
dsList[iRow].D1 = txtD1.Text;
}
....
iRow++;
}
Is there any way to make this shorter like one liner? Does the API have this?
gvName.ReverseDataBind();