protected void grdOutstandingInvoice_RowDataBound(object sender, GridViewRowEventArgs e)
{
var index = GetColumnIndexByName(grid,name);
}
Replace the above function with the following
protected void grdOutstandingInvoice_RowDataBound(object sender, GridViewRowEventArgs e)
{
var index = GetColumnIndexByName(grdOutstandingInvoice,poNo);
}
if it is not working, please try with the following function
<pre>static public int GetColumnIndexByDBName(GridView grdOutstandingInvoice, String poNo)
{
System.Web.UI.WebControls.BoundField DataColumn;
for (int Index = 0; Index < grdOutstandingInvoice.Columns.Count; Index++)
{
DataColumn = grdOutstandingInvoice.Columns[Index] as System.Web.UI.WebControls.BoundField;
if (DataColumn != null)
{
if (DataColumn.DataField == poNo)
return Index;
}
}
return -1;
}