Gridview RowDataBound Access Data Values

5/1/2025 C#
Gridview RowDataBound Access Data Values

Access data values in a Gridview using RowDataBound.

protected void GridViewOrders_RowDataBound(object sender, GridViewRowEventArgs e)

{

  if (e.Row.RowType == DataControlRowType.DataRow)

  {

    LinkButton sndTextButton = (LinkButton)e.Row.FindControl("LinkButtonSendText");

    int orderStatusCode = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "OrderStatusCode"));

    var cellphone = DataBinder.Eval(e.Row.DataItem, "ClientCellPhone");

 

    if (orderStatusCode == 3 && cellphone.ToString().Length > 10)

    {

      sndTextButton.Visible = true;

    }

  }

}

‹ Back to List

 

120 OLD FREEMANS WAY, BREWSTER, MA 02631
MAILING: P.O. BOX 2342, BREWSTER, MA 02631