private int FindIndexByDataField(GridView gv, string datafieldname)
{
int index = -1, cnum = 0;
foreach (DataControlField col in gv.Columns)
{
if (col is BoundField)
{
BoundField coll = (BoundField)gv.Columns[cnum];
if (coll.DataField == datafieldname)
{
index = cnum;
break;
}
}
cnum++;
}
return index;
}
protected void grd_Invoice_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
tpUpdateBy = grd_Invoice.Rows[e.RowIndex].Cells[FindIndexByDataField(grd_Invoice, "I_TP_UpdateBy")].Text;
}
reference :- https://stackoverflow.com/questions/35795278/how-to-get-boundfield-value-of-a-gridview-in-rowupdating-event
No comments:
Post a Comment