Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     

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"];

Share this article   |    Print    |    Article read by 6159 times
Rohit kakria
I am software developer
Related Articles:
Related Interview Questions: No related interview question