What is the use of <%# Eval("") %>. I am not able to understand what is the purpose ot this thing.<asp:DataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1">
<ItemTemplate>
name:
<asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
<br />
id:
<asp:Label ID="idLabel" runat="server" Text='<%# Eval("id") %>' />
<<br />br />
ItemTemplate>
asp:DataList>
Loading

Irshad VazaPosted Jun 24, 2011, 12:46 AM
Posted Jun 15, 2011, 5:39 AM
Eval is a protected method defined on the TemplateControl class, from which the Page class is derived.
Bind is a new ASP.NET 2.0 databinding keyword. It's not a method of any specific class.
Eval is used for unidirectional (readonly) data binding, while Bind is for bi-directional (editable) databinding.
ASP.NET supports a hierarchical data-binding model that creates bindings between server control properties and data sources. Almost any server control property can be bound against any public field or property on the containing page or on the server control's immediate naming container.
Data-binding expressions use the Eval and Bind methods to bind data to controls and submit changes back to the database. The Eval method is a static (read-only) method that takes the value of a data field and returns it as a string. The Bind method supports read/write functionality with the ability to retrieve the values of data-bound controls and submit any changes made back to the database.
You can bind to XML data from an XmlDataSource control using the XPath and XPathSelect methods, as well as the XPathBinder class.
http://forums.asp.net/t/1087297.aspx/1
Dorababu MekaPosted Jun 15, 2011, 3:52 AM
Krishna GaradPosted Jun 15, 2011, 3:29 AM