what is the use of Eval() in asp.net

后端 未结 3 2002
独厮守ぢ
独厮守ぢ 2020-12-02 22:36

What is the use of Eval() in ASP.NET?

3条回答
  •  一向
    一向 (楼主)
    2020-12-02 23:19

    Eval is used to bind to an UI item that is setup to be read-only (eg: a label or a read-only text box), i.e., Eval is used for one way binding - for reading from a database into a UI field.

    It is generally used for late-bound data (not known from start) and usually bound to the smallest part of the data-bound control that contains a whole record. 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.

提交回复
热议问题