PDA

View Full Version : متد Eval



اوبالیت به بو
پنج شنبه 19 شهریور 1388, 23:27 عصر
<%# Eval("ID") %>
اين متد چيه؟
دستور فوق كارش چيه؟
و هر توضيح و نكته اي كه راجب به اين متد مي دونيد به من ارائه بديد.
ممون.

مهدی کرامتی
جمعه 20 شهریور 1388, 01:46 صبح
برگرفته از راهنمای ویژوال استودیو:
Using the Eval Method

The Eval method evaluates late-bound data expressions in the templates of data-bound controls such as the GridView, DetailsView, and FormView controls. At run time, the Eval method calls the Eval method of the DataBinder object, referencing the current data item of the naming container. The naming container is generally the smallest part of the data-bound control that contains a whole record, such as a row in a GridView control. You can therefore use the Eval method only for binding inside templates of a data-bound control.
The Eval method takes the name of a data field and returns a string containing the value of that field from the current record in the data source. You can supply an optional second parameter to specify a format for the returned string. The string format parameter uses the syntax defined for the Format method of the String class.