Name

DataBinder

Synopsis

This class contains a single shared utility method, Eval(), which allows you to specify data binding for controls like System.Web.UI.WebControls.DataList and System.Web.UI.WebControls.Repeater. The Eval() method accepts a string that identifies a field in the control’s data source and uses it to retrieve the corresponding information. For example, the statement <%# DataBinder.Eval(Container.DataItem, "Name") %> in a template for a data control would retrieve data from the Name field of the control’s bound data table. Note that you don’t need to use this method to create a data binding expression (you can just use the <%# Container.DataItem("Name") %> syntax, which is faster). However, using the DataBinder method gives you the chance to supply a format string to configure date or numeric values.

Public NotInheritable Class DataBinder
                  ' Public Constructors
   Public Sub New() 
' Public Shared Methods
   Public Shared Function Eval(ByVal container As Object, 
        ByVal expression As String) As Object  
   Public Shared Function Eval(ByVal container As Object, 
        ByVal expression As String, 
        ByVal format As String) As String  
   Public Shared Function GetIndexedPropertyValue(
        ByVal container As Object, 
        ByVal expr As String) As Object  
   Public Shared Function GetIndexedPropertyValue(
        ByVal container As Object, 
        ByVal propName As String, 
        ByVal format As String) As String  
   Public Shared Function GetPropertyValue( ByVal container As Object, ByVal propName As String) As Object Public Shared Function ...

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.