Xpode.com        Click here to Print this article.

Syntax of DataBinder.Eval(Container.DataItem) in code behind

When we want to access the value of row of dataset or make any condition on any value of datalist or datagrid or Gridview. Then we use DataItemBound of datalist and datagrid or rowbound of Gridview. With following code we may use in code behind.

If we want to access column in HTML the we write

<% DataBinder.Eval (Container.DataItem,"ColumnName") %>.

The same can be accessed in code behind with following code.
Dim myField As String = DataBinder.Eval(e.Item.DataItem,"MyField")

or DataRowView dr = (DataRowView) e.Item.DataItem; dr["myColumn"];


Contributed by:
Rohit kakria
I am software developer

Resourse address on xpode.com

Click here to go on website