1
Reply

What are the different types of databinding in ASP.NET?

surekha

surekha

Jan 30, 2007
9.9k
0

    Different types of Databind in ASP.Net

    1.<%# Container.DataItem("expression") %>

    2.<%# DataBinder.Eval(Container.DataItem, "expression"[, "format"]) %>

    3.<%# Eval("expression") %>

    4.<%# Bind("expression"[, "format"]) %>

    As with the Eval method, the Bind method has two overloads, which means that it can be used with or without
    the "format" parameter. In fact, other than specifying the new method name, the Bind method is used just
    like the Eval method. To bind an attribute of a control to the CompanyName column, you use:

    Example:
    <%# Eval("Price", "Special Offer {0:C} for Today Only!") %>
    <%# Bind("CompanyName") %>
    <%# Bind("OrderDate", "{0:dddd d MMMM}") %>

    February 10, 2007
    0